Skip to content

Instantly share code, notes, and snippets.

@b-abctech
Created November 15, 2013 09:38
Show Gist options
  • Save b-abctech/7481717 to your computer and use it in GitHub Desktop.
Save b-abctech/7481717 to your computer and use it in GitHub Desktop.
comparing elastic search query between specific range of date and using *
# ------------- using * ---------------------
POST /logstash-*/_search
{
"query": {
"filtered": {
"query": {
"match_phrase": {
"@fields.request": "/sok/google"
}
},
"filter": {
"numeric_range": {
"@timestamp": {
"lt": "2013-11-13T23:59:59",
"gte": "2013-11-10T00:00:00"
}
}
}
}
},
"facets": {
"q": {
"terms": {
"field": "@fields.q.not_analyzed",
"size": 100
}
}
}
}
#--------------- using specific date --------------
POST /logstash-2013.11.14,logstash-2013.11.13,logstash-2013.11.12,logstash-2013.11.11,logstash-2013.11.10,logstash-2013.11.09/_search
{
"query": {
"filtered": {
"query": {
"match_phrase": {
"@fields.request": "/sok/google"
}
},
"filter": {
"numeric_range": {
"@timestamp": {
"lt": "2013-11-13T23:59:59",
"gte": "2013-11-10T00:00:00"
}
}
}
}
},
"facets": {
"q": {
"terms": {
"field": "@fields.q.not_analyzed",
"size": 100
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment