Hello,
As documented in your documentation here, the documentation shows using dot-notation to traverse a nested field (user -> id). However, when using the query dsl this way, no results are returned.
Instead, you must use the nested query DSL structure in order to perform terms queries on nested fields.
Examples
Does Not work as documented
{
"query": {
"terms": {
"foo.object_id": [
"obj.lvu3r6PlxWwiSWuU"
]
}
}
}
** Works using nested DSL **
{
"query": {
"nested": {
"path": "foo",
"query": {
"terms": {
"foo.object_id": [
"obj.lvu3r6PlxWwiSWuU"
]
}
}
}
}
}
I have seen the other threads where Elastic folks have confirmed you have to used the nested DSL, but my question is ..... why do you have a documented example on the latest release that shows otherwise?
Is this a bug or is your documentation just wrong/confusing?
If its just confusing, then I would love to know the easiest way to submit documentation change requests that actually get processed in a timely manner.
I think it's easy for folks that live and breath Elasticsearch to just "know" this was a documentation issue, but for newcomers this wastes a ton of valuable time. Especially with dot-notation being so prolific in many/most top-5 popular programming languages.
Thanks for any feedback/help here.