I have two indices. One contains a nested object and the other one doesn't. When I try to execute a query on both of these indices, I get the following error:
IllegalStateException[[nested] failed to find nested object under path [nestedItems]]; ]
Basically the same error as described in this question. There the answer suggest that I should use the indices
query. I was able to find method QueryBuilders.indicesQuery(...)
in the Java API 5.0 docs.
However, the indices
query was deprecated in 5.0 stating:
Deprecated in 5.0.0. Search on the _index field instead.
I couldn't find a way to use the _index
field in current API (7.0). How can I use it from Java?
Solved: turned out that nested
query has attribute ignore_unmapped
which should be set to true.