Need to get result from outer object from inner properties


(Nayan Mahale) #1

i have mapping like below,

"name": {
"properties": {
"en": {
"type": "text",
"fields": {
"custom": {
"type": "text",
"analyzer": "custom_english"
},
"raw": {
"type": "keyword",
"index": true
}
}
},
"hn": {
"type": "text",
"fields": {
"custom": {
"type": "text",
"analyzer": "custom_hindi"
},
"raw": {
"type": "keyword",
"index": true
}
}
}
}
}

i have a data in properties "en" and "hn" respectively,

name:{
en:"Kodomo Soft & Slim Toothbrush - Dark Pink",
hn:"कोडोमो सॉफ्ट एंड स्लिम टूथब्रश डार्क पिंक"
}

and i want to perform query like this,

{

"query": {
"nested": {
"path": "products",
"query": {
"bool": {
"must": [
{
"match": {
"products.name": "Kodomo Soft & Slim Toothbrush"
}
}
]
}
}
}
}
}

but i get no result , how can i do query like this please help.Thanks