Elasticsearch 8.2 scenarios to Index Nested Objects Correctly with Specific Mappings
I'm having a hard time understanding After trying multiple solutions online, I still can't figure this out... I've recently upgraded my Elasticsearch instance to version 8.2 and I'm working with issues when trying to index nested objects. My documents have a structure where one of the fields is defined as a nested object, but after indexing, I'm unable to query these nested fields correctly. Here’s a simplified version of the mapping I applied: ```json { "mappings": { "properties": { "user": { "type": "nested", "properties": { "name": { "type": "text" }, "age": { "type": "integer" } } } } } } ``` I thought everything was set up correctly, but when I try to index a document like this: ```json { "user": [ { "name": "Alice", "age": 30 }, { "name": "Bob", "age": 25 } ] } ``` It seems to index fine, as I get a success response. However, when I try to search for users with a specific condition using the nested query: ```json { "query": { "nested": { "path": "user", "query": { "bool": { "must": [ { "match": { "user.name": "Alice" } } ] } } } } } ``` I receive no hits, even though I can see the document indexed in Kibana. I’ve double-checked that I’m using the correct path and field names, but I need to seem to get it to return any results. I also tried using the `inner_hits` option to see if it could return any of the nested documents, but that didn’t help either. I’m wondering if there might be an scenario with how nested types are being handled in 8.2, or if there’s something specific in my setup that I might be missing. Any assistance or insights would be highly appreciated! Any help would be greatly appreciated! Has anyone dealt with something similar?