Filtered query with nested filter


(Michał Dąbrowski) #1

Hello,
i have a question. I have structure which is like:
events:
mappings:
id: { type: integer }
categoryId: { type: integer }
countryId: { type: integer }
cityId: { type: integer }
active: { type: boolean }
translations:
type: "nested"
properties:
title: { type: string, boost: 5,
analyzer: autocomplete }
description: { type: string, boost: 4 }
what: { type: string, boost: 3 }
whenText: { type: string, boost: 3 }
whereText: { type: string, boost: 3 }
info: { type: string, boost: 2 }
locale: { type: string }

And i query like this:
{
"query": {
"filtered": {
"query": {
"query_string": {
"query": "attente",
"default_operator": "OR"
}
},
"filter": {
"and": [
{
"term": {
"active": true
}
},
{
"nested": {
"path": "dates",
"filter": {
"range": {
"dates.datetime": {
"from": "2014-07-09",
"to": "2015-07-09"
}
}
},
"_cache": true
}
}
]
}
}
},
"facets": {
"category": {
"terms": {
"field": "categoryId",
"size": 10000
}
},
"country": {
"terms": {
"field": "countryId",
"size": 10000
}
},
"city": {
"terms": {
"field": "venue.city.id",
"size": 10000
},
"nested": "venue.city"
}
}
}

This search query yet searches though all translations. How can i limit
that query to return nested translations only when locale is en|it etc?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ffb6cd4a-4165-45fe-aead-e05d32439c11%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2