Multi_search: "Unknown key for a START_OBJECT in [multi_match]."

Data:

PUT /my_index/my_type/1
{
    "title": "Quick brown rabbits",
    "body":  "Brown rabbits are commonly seen."
}

PUT /my_index/my_type/2
{
    "title": "Keeping pets healthy",
    "body":  "My quick brown fox eats rabbits on a regular basis."
}

Code:

GET my_index/my_type/_search
{
    "multi_match": {
        "query":                "Quick brown fox",
        "type":                 "best_fields", 
        "fields":               [ "title", "body" ],
        "tie_breaker":          0.3,
        "minimum_should_match": "30%" 
    }
}

Error:

{
  "error": {
    "root_cause": [
      {
        "type": "parsing_exception",
        "reason": "Unknown key for a START_OBJECT in [multi_match].",
        "line": 2,
        "col": 20
      }
    ],
    "type": "parsing_exception",
    "reason": "Unknown key for a START_OBJECT in [multi_match].",
    "line": 2,
    "col": 20
  },
  "status": 400
}

How should I resolve this error?

You need to put your query in the query part of the search request body. Try this:

GET my_index/my_type/_search
{
  "query": {
    "multi_match": {
      "query": "Quick brown fox",
      "type": "best_fields",
      "fields": [
        "title",
        "body"
      ],
      "tie_breaker": 0.3,
      "minimum_should_match": "30%"
    }
  }
}
1 Like

Thankyou @colings86 for resolving the issue.

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