Shivam Gupta
Shivam Gupta

Reputation: 82

getting parsing exception in elastic search query


This error only occurs when i'm adding to type in query but i need to add the type so please help me. Here is an error i'm getting when i query to ES

{
"error": {
    "root_cause": [
        {
            "type": "parse_exception",
            "reason": "failed to parse [multi_match] query type [knowledge]. unknown type."
        }
    ],
    "type": "parse_exception",
    "reason": "failed to parse [multi_match] query type [knowledge]. unknown type."
},
"status": 400}

my query(elastic search) is:

{
  "query": {
    "multi_match" : {
      "query":   "computer",
      "type": "knowledge",
      "fields": ["topic.name","title" ] 
    }
  }
}`

i've used "type" and "_type" in query both are not working in my case.

Upvotes: 0

Views: 1288

Answers (1)

Jai Sharma
Jai Sharma

Reputation: 733

The type here doesn't has the same meaning as you're thinking it to be. The possible variants for type are best_fields, most_fields, etc. Please refer this for more details.

For you specific case, you should make a request like this:

GET index_name/your_type/_search/
{
  "query": {
    "multi_match" : {
      "query":   "computer",
      "fields": ["topic.name","title" ] 
    }
  }
}

Upvotes: 1

Related Questions