How to search in nested query for below case

My mapping is:

PUT bond_covenant
{
  "settings": {
    "index":{
      "analysis":{
        "filter":{
          "synonym":{
            "type":"synonym",
            "synonyms":"Some path"
          },
          "english_stop":{
            "type":"stop",
            "stopwords":"_english_"
          },
          "my_stemmer":{
            "type":"stemmer",
            "name":"english"
          }
        },
        "analyzer":{
          "my_custom_analyzer":{
            "type":"custom",
            "tokenizer":"standard",
            "filter":[
              "lowercase",
              "english_stop",
              "synonym",
              "my_stemmer"
              ]
          }
        }
      }
    }
  }, 
  "mappings": {
    "properties": {
      "name":{"type":"text"},
      "doc": {"type":"nested",
      "properties": {
        "file_name":{"type":"text"},
        "published_date":{"type":"text"},
        "container": {"type":"nested",
        "properties": {
          "heading":{"type":"text"},
          "sections":{"type":"nested",
            "properties":{
              "sec_heading":{"type":"text"},
              "sentences": {"type":"nested",
                "properties":{
                  "text":{"type":"text",
                    "analyzer":"my_custom_analyzer"
                  },
                  "start_offset":{"type":"integer"},
                  "end_offset":{"type":"integer"},
                  "key_phrases":{"type":"nested",
                    "properties":{
                      "score":{"type":"integer"},
                      "phrases":{"type":"text"}
                    }
                  },
                  "entities":{"type":"nested",
                    "properties":{
                      "text":{"type":"text"},
                      "type":{"type":"text"},
                      "start_offset":{"type":"integer"},
                      "end_offset":{"type":"integer"}
                    }
                  },
                  "noun_phrases":{"type":"nested",
                    "properties":{
                      "text":{"type":"text"},
                      "start_offset":{"type":"integer"},
                     "end_offset":{"type":"integer"} 
                    }
                  },
              "sub_sections": {"type":"nested",
                "properties":{
                  "text":{"type":"text"
                  },
                  "start_offset":{"type":"integer"},
                  "end_offset":{"type":"integer"},
                  "key_phrases":{"type":"nested",
                    "properties":{
                      "score":{"type":"integer"},
                      "phrases":{"type":"text"}
                    }
                  },
                  "entities":{"type":"nested",
                    "properties":{
                      "text":{"type":"text"},
                      "type":{"type":"text"},
                      "start_offset":{"type":"integer"},
                      "end_offset":{"type":"integer"}
                    }
                  },
                  "noun_phrases":{"type":"nested",
                    "properties":{
                      "text":{"type":"text"},
                      "start_offset":{"type":"integer"},
                     "end_offset":{"type":"integer"} 
                    }
                  }
                }
              }
            }
          }
        }
      }
      }
    }
  }
      }
    }
  }
}

My search query: It's not working

GET bond_covenant/_search
{
  "_source": ["name","doc.container.heading"],
  "query": {
    "nested": {
      "path": "doc",
       "query": {
              "nested": {
                "path": "doc.container",
                "query": {
                  "nested": {
                    "path": "doc.container.sections",
                    "query": {
                      "nested": {
                        "path": "doc.container.sections.sentences",
                        "query": {
                          "nested": {
                            "path": "doc.container.sections.sentences.sub_sections",
                            "query": {
                                "match": {
                                  "doc.container.sections.sentences.sub_sections.text": "hedging"
                                }
                              }
  
                            }
                          }
                        }
                      }
                    }
                  }
        }
       }      
    }       
  },
    "highlight": {
      "number_of_fragments":5 , 
       "fragment_size" : 400,
      "no_match_size": 0, 
      
        "fields" : {
            "doc.container.sections.sentences.sub_sections.text" : {}
        }
    }
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.