Skip to content

Instantly share code, notes, and snippets.

{
"size": 0,
"query": {
"bool": {
"filter": [{
"range": {
"created_at": {
"gte": "now-3M",
"lte": "now"
}
{
"size": 0,
"query": {
"bool": {
"filter": [{
"range": {
"created_at": {
"gte": "now-1M",
"lte": "now"
}
{"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"}
{
"took": 10,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"total": 1,
"matches": [],
"aggregations": {
{
"doc": {
"text": "スターウォーズのスター・デストロイヤー型ドローン動画が話題に"
},
"aggs": {
"categories": {
"terms": {
"field": "category"
}
}
{
"query": {
"bool": {
"must": [{
"simple_query_string": {
"query": "\"サッカー\"", // 1) 人が与える任意の分類・キーワード
"fields": ["text"] // 2) 検索対象フィールド
}
}],
"filter": [{
{
"took": 8883,
"timed_out": false,
"_shards": {
"total": 90,
"successful": 90,
"failed": 0
},
"hits": {
"total": 2811,
{
"category": "サッカー",
"query": {
"bool": {
"should": [{
"simple_query_string": {
"fields": ["text"],
"default_operator": "or",
"query": "\"サッカー\" "
}
# -*- 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

##alt text GistList: TODO for coders alt text