Skip to content

Instantly share code, notes, and snippets.

@jrots
Created January 13, 2016 11:50
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 jrots/1863d23a4210caed10f0 to your computer and use it in GitHub Desktop.
Save jrots/1863d23a4210caed10f0 to your computer and use it in GitHub Desktop.
Example query
curl -XGET "http://192.168.14.67:9200/users/person/_search" -d '
{
"from": 0,
"size": 20,
"_source": false,
"query": {
"constant_score": {
"filter": {
"bool": {
"must": [
{
"term": {
"gender": "female"
}
},
{
"terms": {
"location.geohash": [
"u143",
"u149",
"u14c",
"u146",
"u14d",
"u14f",
"u147",
"u14e",
"u14g"
]
}
},
{
"term": {
"accountstatus": "active"
}
},
{
"terms": {
"country": [
"be"
]
}
},
{
"range": {
"birthdate": {
"gte": "1981-01-13",
"lte": "1997-01-13"
}
}
}
],
"should": [
{
"range": {
"lastlogindate": {
"gte": "2015-01-13 00:00",
"lte": "2016-01-13 10:00"
}
}
},
{
"range": {
"lastlogindate": {
"gte": "2016-01-13 10:00",
"lte": "2016-01-13 10:11"
}
}
}
]
}
}
}
}
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment