Skip to content

Instantly share code, notes, and snippets.

@nkcoder
Last active August 29, 2015 14:27
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 nkcoder/9b37a4c53949d1590fea to your computer and use it in GitHub Desktop.
Save nkcoder/9b37a4c53949d1590fea to your computer and use it in GitHub Desktop.
ES query
{
"query": {
"bool": {
"must": [
{
"term": {
"gender": 2
}
},
{
"term": {
"countryId": 36
}
}
]
}
}
}
{
"query": {
"match_all": {}
},
"sort": [{
"_geo_distance": {
"location": "48.2354, 2.9745",
"unit": "km"
}
}]
}
{
"query": {
"filtered": {
"query": {
"term": {
"gender": 2
}
},
"filter": {
"and": [
{
"range": {
"age": {
"gte": 10,
"lte": 20
}
}
},
{
"not": {
"terms": {
"userId": [
1680
]
}
}
}
]
}
}
},
"sort": [
{
"_geo_distance": {
"locationCoordinate": "48.2354, 2.9745",
"unit": "km"
}
}
]
}
{
"query": {
"filtered": {
"query": {
"bool": {
"must": {
"term": {
"countryId": 36
}
}
}
},
"filter": {
"not": {
"terms": {
"userId": [
1678,2
]
}
}
}
}
}
}
{
"query": {
"filtered": {
"query": {
"term": {
"gender": 2
}
},
"filter": {
"not": {
"terms": {
"userId": [
1190
]
}
}
}
}
},
"sort": [
{
"_geo_distance": {
"locationCoordinate": "48.2354, 2.9745",
"unit": "km"
}
}
]
}
{
"query": {
"filtered": {
"query": {
"term": {
"gender": 2
}
},
"filter": {
"range": {
"age": {
"gte": 10,
"lte": 20
}
}
}
}
},
"sort": [
{
"_geo_distance": {
"locationCoordinate": "48.2354, 2.9745",
"unit": "km"
}
}
]
}
{
"fields": [
"userId",
"nickName",
"avatarUrl",
"gender",
"age",
"schoolChnName"
],
"query": {
"filtered": {
"query": {
"term": {
"gender": 2
}
},
"filter": {
"and": [
{
"range": {
"age": {
"gte": 10,
"lte": 20
}
}
},
{
"not": {
"terms": {
"userId": [
1680
]
}
}
}
]
}
}
},
"sort": [
{
"_geo_distance": {
"locationCoordinate": "48.2354, 2.9745",
"unit": "km"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment