Parsing Exception - "no [query] registered for [has_child]"

Hi
I was using ES version 5.0.5. Recently I made a security patch update that takes it me to 5.0.6. Earlier it was working absolutely fine but now It have started throwing the following error -

Elasticsearch::Transport::Transport::Errors::BadRequest: [400] {"error":{"root_cause":[{"type":"parsing_exception","reason":"no [query] registered for [has_child]","line":1,"col":694}],"type":"parsing_exception","reason":"no [query] registered for [has_child]","line":1,"col":694},"status":400}
{
  "query": {
    "function_score": {
      "query": {
        "bool": {
          "should": [
            {
              "multi_match": {
                "query": "test",
                "fields": [
                  "subject",
                  "subject.synonym^0.8"
                ],
                "fuzziness": "AUTO",
                "prefix_length": 2,
                "boost": 2
              }
            },
            {
              "has_child": {
                "type": "post",
                "score_mode": "avg",
                "query": {
                  "function_score": {
                    "query": {
                      "multi_match": {
                        "query": "test",
                        "fields": [
                          "stripped_text",
                          "stripped_text.synonym^0.8"
                        ],
                        "fuzziness": "AUTO",
                        "prefix_length": 2
                      }
                    },
                    "functions": [
                      {
                        "filter": {
                          "term": {
                            "root_post": true
                          }
                        },
                        "weight": 3
                      },
                      {
                        "field_value_factor": {
                          "field": "post_votes_count",
                          "modifier": "log2p",
                          "missing": 0
                        }
                      },
                      {
                        "filter": {
                          "term": {
                            "is_best_answer": true
                          }
                        },
                        "weight": 2
                      },
                      {
                        "filter": {
                          "range": {
                            "created_at": {
                              "gte": "now-2y"
                            }
                          }
                        },
                        "weight": 2
                      },
                      {
                        "filter": {
                          "range": {
                            "created_at": {
                              "gte": "now-5y",
                              "lt": "now-2y"
                            }
                          }
                        },
                        "weight": 1
                      }
                    ],
                    "score_mode": "sum"
                  }
                },
                "inner_hits": {
                  "_source": false,
                  "size": 1,
                  "highlight": {
                    "fields": {
                      "stripped_text": {},
                      "stripped_text.synonym": {}
                    },
                    "pre_tags": [
                      "<strong>"
                    ],
                    "post_tags": [
                      "</strong>"
                    ]
                  }
                }
              }
            }
          ],
          "minimum_should_match": 1,
          "filter": {
            "bool": {
              "must": [
                {
                  "term": {
                    "deleted": 0
                  }
                },
                {
                  "range": {
                    "last_post_created_at": {
                      "gte": "now-1y"
                    }
                  }
                }
              ],
              "must_not": [
                {
                  "term": {
                    "awaiting_moderation": true
                  }
                },
                {
                  "term": {
                    "private": true
                  }
                }
              ]
            }
          }
        }
      },
      "functions": [
        {
          "filter": {
            "range": {
              "ranking": {
                "gte": 0
              }
            }
          },
          "field_value_factor": {
            "field": "ranking",
            "modifier": "log2p"
          }
        },
        {
          "field_value_factor": {
            "field": "post_counter",
            "modifier": "log2p"
          }
        },
        {
          "filter": {
            "range": {
              "last_post_created_at": {
                "gte": "now-2y"
              }
            }
          },
          "weight": 2
        },
        {
          "filter": {
            "range": {
              "last_post_created_at": {
                "gte": "now-5y",
                "lt": "now-2y"
              }
            }
          },
          "weight": 1
        },
        {
          "filter": {
            "exists": {
              "field": "answered_post_id"
            }
          },
          "weight": 1
        }
      ],
      "score_mode": "sum"
    }
  }
}

I will be really grateful and appreciate if you can provide me with any solution or can guide me.

Hi @Prayas_Arora thanks for submitting a question!

First of all, your query DSL looks reasonable, but if you're using Elastic v5.x that is a very old version that is well past end of life. I'd strongly suggest considering upgrading if you can.

With that said, it sounds like people have run into this before on 5.6, and you may have to use plugins. See this previous post for more information.

Good luck!

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