Created
January 20, 2016 18:49
-
-
Save nguyenhoaibao/ea2a99e3139b500e6874 to your computer and use it in GitHub Desktop.
Es 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
{ | |
"query": { | |
"filtered": { | |
"filter": { | |
"bool": { | |
"must": [ | |
{ | |
"range": { | |
"meta.created_time": { | |
"gte": "2016-01-01T00:00:00.000Z", | |
"lte": "2016-01-20T16:59:59.000Z" | |
} | |
} | |
}, | |
{ | |
"or": [ | |
{ | |
"term": { | |
"is_showed": 1 | |
} | |
}, | |
{ | |
"nested": { | |
"path": "snippets", | |
"filter": { | |
"bool": { | |
"must": [ | |
{ | |
"or": [ | |
{ | |
"term": { | |
"snippets.sentiment": "negative" | |
} | |
}, | |
{ | |
"term": { | |
"snippets.sentiment": "positive" | |
} | |
}, | |
{ | |
"term": { | |
"snippets.sentiment": "neutral" | |
} | |
} | |
] | |
} | |
] | |
} | |
} | |
} | |
} | |
] | |
} | |
], | |
"must_not": { | |
"query": { | |
"query_string": { | |
"fields": [ | |
"title.folded", | |
"content.folded", | |
"share_content.folded", | |
"post.content.folded" | |
], | |
"query": "\"tiki taka\" \"tikitaka\" \"xaytruong.org\"" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"aggs": { | |
"sentiments_path": { | |
"nested": { | |
"path": "snippets" | |
}, | |
"aggs": { | |
"sentiments": { | |
"terms": { | |
"field": "snippets.sentiment" | |
}, | |
"aggs": { | |
"date_range": { | |
"date_histogram": { | |
"field": "snippets.created_time", | |
"interval": "day", | |
"format": "dd/MM/yyyy", | |
"time_zone": "+07:00", | |
"min_doc_count": 0, | |
"extended_bounds": { | |
"min": "01/01/2016", | |
"max": "20/01/2016" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment