Mutliple nested types in the same query


(Lengoyvaerts) #1

Hi

I started this discussion in the wrong place
( https://github.com/elastic/elasticsearch/issues/15503#issuecomment-166240728), so I'll post it here.

I have a question to which I can't seem to find an answer anywhere.

Let's say I have an Index type with a mapping that contains two or more nested types (parallel, not deeply nested - see below):

... "field1": { "type": "nested", "properties": { "subfield1": { "type": "string" }, "subfield2": { "type": "integer" } } }, "field2": { "type": "nested", "properties": { "subfield1": { "type": "string" }, "subfield2": { "type": "integer" } } } ...

Now I want to use both these nested fields in the same query. To explain this with a simple example:

I want to know which records have:
field1.subfield1 = "Hello world" and
field2.subfield2 = 5.

How can I put this logic in a query?


(system) #2