Hi. need help with querying 2 level deep nested objects using wildcard for paths
my mapping looks like this:
{
"article": {
"dynamic_templates": [
{
"en": {
"path_match": "versions.*en",
"mapping": {
"type": "nested",
"properties": {
"title": {
"type": "string",
"analyzer": "english"
},
"content": {
"type": "string",
"analyzer": "english"
}
}
}
}
},
{
"standard": {
"path_match": "versions.*",
"mapping": {
"type": "nested",
"properties": {
"title": {
"type": "string",
"analyzer": "standard"
},
"content": {
"type": "string",
"analyzer": "standard"
}
}
}
}
}
],
"properties": {
"source": {
"type": "string",
"index": "not_analyzed"
},
"external_id": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
I have nested field called versions and it contains many article versions like this:
{
"source": "forbes",
"external_id": "1234",
"versions": {
"en": {
"title": "title en",
"content": "content en"
},
"localized_en": {
"title": "title localized en",
"content": "content localized en"
},
"fr": {
"title": "title fr",
"content": "content fr"
}
}
}
query like this is working as expected
{
"query": {
"nested": {
"path": "versions",
"query": {
"nested": {
"path": "versions.en",
"query": {
"match": {
"versions.en.content": "content"
}
}
}
}
}
}
}
I was trying to use multi_match query , but with no luck:
{
"query": {
"nested": {
"path": "versions",
"query": {
"multi_match": {
"query": "content",
"fields": [
"versions.*.content"
]
}
}
}
}
}
Is there any way to do this?