Я хочу найти все вложенные документы, которые все равны, мое упругое отображение поиска выглядит следующим образом
{
"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"
}
}
}
}
}
}
}
}
Это мой запрос bool
{
"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",
"ignore_unmapped" : false,
"score_mode" : "avg",
"boost" : 1.0
}
}
],
"adjust_pure_negative" : true,
"boost" : 1.0
}
}
}
Это дает мне, еслилюбой из вложенных attributeChild_responsible.responsible_id, равный «100», я смотрю, если все вложенные в этот документ должны иметь 100, то возвращать только результат