Skip to content

Instantly share code, notes, and snippets.

@cknv
Created August 28, 2015 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cknv/af491aa48ff0021cce11 to your computer and use it in GitHub Desktop.
Save cknv/af491aa48ff0021cce11 to your computer and use it in GitHub Desktop.
{
"from": 0,
"query": {
"filtered": {
"query": {
"filtered": {
"query": {
"bool": {
"minimum_should_match": 1,
"must": [
{
"bool": {
"minimum_should_match": 1,
"should": [
{
"match_phrase": {
"content.body": "<some phrase>"
}
},
{
"match": {
"content.title": {
"type": "phrase",
"boost": 2,
"query": "<some phrase>"
}
}
}
]
}
},
{
"multi_match": {
"type": "cross_fields",
"query": "<some term>",
"fields": [
"content.title^2",
"content.body"
]
}
}
]
}
},
"filter": {
"bool": {
"must": [
{
"range": {
"content.posted_time": {
"gte": "2015-08-20T00:00:00",
"lte": "2015-08-27T23:59:59"
}
}
},
{
"terms": {
"source": [
"blogs-and-comments",
"other-social-networks",
"forums",
"classifieds",
"instagram",
"wikis",
"facebook",
"reviews",
"twitter",
"google-plus",
"news",
"youtube"
],
"_cache": true
}
}
]
}
}
}
}
}
},
"size": 0,
"aggs": {
"query.timeseries": {
"aggs": {
"timeseries": {
"date_histogram": {
"format": "yyyy-MM-dd'T'HH:mm:ss'Z'",
"extended_bounds": {
"max": "2015-08-27T23:59:59Z",
"min": "2015-08-20T00:00:00Z"
},
"field": "content.posted_time",
"interval": "6911.99999s",
"min_doc_count": 0
}
}
},
"filter": {
"bool": {
"must": [
{
"range": {
"content.posted_time": {
"gte": "2015-08-20T00:00:00",
"lt": "2015-08-27T23:59:59"
}
}
}
]
}
}
},
"query.total_count": {
"filter": {
"bool": {
"must": [
{
"range": {
"content.posted_time": {
"gte": "2015-08-20T00:00:00",
"lt": "2015-08-27T23:59:59"
}
}
}
]
}
}
},
"query.sentiment_polarity": {
"aggs": {
"terms": {
"terms": {
"field": "enrichments.sentiment.polarity",
"size": 10,
"min_doc_count": 0
}
},
"missing": {
"missing": {
"field": "enrichments.sentiment.polarity"
}
}
},
"filter": {
"bool": {
"must": [
{
"range": {
"content.posted_time": {
"gte": "2015-08-20T00:00:00",
"lt": "2015-08-27T23:59:59"
}
}
}
]
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment