Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
Opensearch: 1.3.3
Describe the issue:
I’m trying to search on a nested property of another property that isn’t nested. My mappings looks like:
{
"mappings": {
"properties": {
"my-non-nested-property": {
"properties": {
"my-nested-property": {
"type": "nested",
"properties": {
"prop1": {
"type": "text"
},
"prop2": {
"type": "text"
},
"prop3": {
"type": "keyword"
},
"prop4": {
"properties": {
"type": {
"type": "text"
},
"value": {
"type": "text"
}
}
},
"prop5": {
"type": "text"
},
"prop6": {
"type": "date"
},
"prop7": {
"type": "date"
}
}
},
"index": {
"type": "keyword"
}
}
}
}
}
}
And this is the search I’m trying to use:
{
"query": {
"nested": {
"path": "my-non-nested-property.my-nested-property",
"query": {
"bool": {
"should": [
{
"term": {
"my-non-nested-property.my-nested-property.prop1": "AVALUE"
}
}
]
}
}
}
}
}
I’ve populated the index with a single document that has a my-non-nested-property.my-nested-property.prop1
set as “AVALUE”, but I cannot find the value using the filter I described. I’m new to opensearch, so I might be doing something wrong. I can confirm that if “my-nested-property” is a first-order property (on the same level as my-non-nested-property), I can search using nested queries, the problem seems when I have a nested property as a child of non-nested properties. I appreciate any advice about how to search on the described use-case.
Thank you,
Best regards.