How to search for nested elements using query string in Elastic Search?

I read the Query String documentation, but did not find references to nested fields: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html

I could use a JSON-formatted subquery / filter, but I would really like to use query strings, as they are more convenient for ad-hoc search. Fields that interest me are declared as "nested" in the display, for example.

"tags": { "type": "nested", "properties": { "name": { "type": "string", "index": "not_analyzed" }, "value": { "type": "string", "index": "not_analyzed" }, // more fields, snipped } }, 

A query string, such as q=tags.name:MyTag , never returns any results. The same query expressed using a query or a nested term filter works.

Thanks! - Sharat

+6
source share

Source: https://habr.com/ru/post/978063/


All Articles