This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"size": 0, | |
"query": { | |
"bool": { | |
"filter": [{ | |
"range": { | |
"created_at": { | |
"gte": "now-3M", | |
"lte": "now" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"size": 0, | |
"query": { | |
"bool": { | |
"filter": [{ | |
"range": { | |
"created_at": { | |
"gte": "now-1M", | |
"lte": "now" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"index": {"_index": "userkeyword", "_type": "logs"}} | |
{"keyword": "銀座", "created": "2015-12-18T12:35:00"} | |
{"index": {"_index": "userkeyword", "_type": "logs"}} | |
{"keyword": "銀座", "created": "2015-12-18T12:35:00"} | |
{"index": {"_index": "userkeyword", "_type": "logs"}} | |
{"keyword": "銀座", "created": "2015-12-18T12:35:00"} | |
{"index": {"_index": "userkeyword", "_type": "logs"}} | |
{"keyword": "銀座", "created": "2015-12-18T12:35:00"} | |
{"index": {"_index": "userkeyword", "_type": "logs"}} | |
{"keyword": "銀座三越", "created": "2015-12-18T12:35:00"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"took": 10, | |
"_shards": { | |
"total": 5, | |
"successful": 5, | |
"failed": 0 | |
}, | |
"total": 1, | |
"matches": [], | |
"aggregations": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"doc": { | |
"text": "スターウォーズのスター・デストロイヤー型ドローン動画が話題に" | |
}, | |
"aggs": { | |
"categories": { | |
"terms": { | |
"field": "category" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"query": { | |
"bool": { | |
"must": [{ | |
"simple_query_string": { | |
"query": "\"サッカー\"", // 1) 人が与える任意の分類・キーワード | |
"fields": ["text"] // 2) 検索対象フィールド | |
} | |
}], | |
"filter": [{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"took": 8883, | |
"timed_out": false, | |
"_shards": { | |
"total": 90, | |
"successful": 90, | |
"failed": 0 | |
}, | |
"hits": { | |
"total": 2811, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"category": "サッカー", | |
"query": { | |
"bool": { | |
"should": [{ | |
"simple_query_string": { | |
"fields": ["text"], | |
"default_operator": "or", | |
"query": "\"サッカー\" " | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from __future__ import print_function, unicode_literals | |
import json | |
import boto3 | |
import logging | |
from elasticsearch import Elasticsearch | |
from elasticsearch import helpers | |
from elasticsearch.exceptions import ElasticsearchException |
NewerOlder