Reputation: 3847
I have the following 2 queries:
GET places/_search
{
"query": {
"filtered": {
"filter": {
"bool": {
"should": [
{
"term": {
"approved": false
}
}
]
}
}
}
}
}
GET places/_search
{
"query": {
"filtered": {
"filter": {
"geo_bounding_box": {
"loc": {
"top_left": "54.6152065515344, -6.09334913041994",
"bottom_right": "54.5754258987271, -5.76633420732423"
}
}
}
}
}
}
Both work fine, however I am having issues combining the queries and was wondering if anyone could help. Basically I want to retuen all items within the bounding box specified, where the "approved" property is false.
Upvotes: 0
Views: 47
Reputation: 217254
You can keep your filtered
query and merge both conditions simply like this inside in a bool/must
filter
curl -XPOST localhost:9200/places/_search -d '{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"term": {
"approved": false
}
},
{
"geo_bounding_box": {
"loc": {
"top_left": "54.6152065515344, -6.09334913041994",
"bottom_right": "54.5754258987271, -5.76633420732423"
}
}
}
]
}
}
}
}
}'
Upvotes: 1