Hello Team,
Please help me on this issue ,
I want to search all the nested documents which all are equals , my elastic search mapping look like this
{
"attribute_search_index": {
"mappings": {
"attribute_search": {
"dynamic": "true",
"properties": {
"attrId": {
"type": "text"
},
"attrName": {
"type": "text"
},
"attributeChildData": {
"type": "nested",
"properties": {
"attributeChildId": {
"type": "integer"
},
"attributeChildTxt": {
"type": "text"
},
"attributeChild_responsible": {
"type": "nested",
"properties": {
"responsible_id": {
"type": "integer"
},
"responsible_name": {
"type": "text"
}
}
},
"attrId": {
"type": "integer"
}
}
},
"attributePrj": {
"type": "nested",
"properties": {
"attributePrj_Id": {
"type": "integer"
},
"attributePrj_name": {
"type": "keyword"
}
}
}
}
}
}
}
}
This is my bool query
{
"query":{
"bool" : {
"must" : [
{
"nested" : {
"query" : {
"bool" : {
"must" : [
{
"match" : {
"attributePrj.name" : {
"attributePrj_name" : "PROJ 121",
"operator" : "OR",
"prefix_length" : 0,
"max_expansions" : 50,
"fuzzy_transpositions" : true,
"lenient" : false,
"zero_terms_query" : "NONE",
"auto_generate_synonyms_phrase_query" : true,
"boost" : 1.0
}
}
}
],
"adjust_pure_negative" : true,
"boost" : 1.0
}
},
"path" : "attributePrj",
"ignore_unmapped" : false,
"score_mode" : "avg",
"boost" : 1.0
}
},
{
"nested" : {
"query" : {
"bool" : {
"must" : [
{
"match" : {
"attributeChildData.attributeChild_responsible.responsible_id" : {
"query" : "100",
"operator" : "OR",
"prefix_length" : 0,
"max_expansions" : 50,
"fuzzy_transpositions" : true,
"lenient" : false,
"zero_terms_query" : "NONE",
"auto_generate_synonyms_phrase_query" : true,
"boost" : 1.0
}
}
}
],
"adjust_pure_negative" : true,
"boost" : 1.0
}
},
"path" : "attributeChildData.attributeChild_responsible",
"ignore_unmapped" : false,
"score_mode" : "avg",
"boost" : 1.0
}
}
],
"adjust_pure_negative" : true,
"boost" : 1.0
}
}
}
This gives me if any of the nested attributeChild_responsible.responsible_id equal "100" , I am looking if all nested under that document must have 100 then only return the result