1

I have the following query in my ElasticSearch (I'm using version 1.6) application:

{
    "query":{
        "span_multi":{
            "match":{
                "query_string": {
                    "fields": ["field_name"],
                    "query": "*term*"
                }
            }
        }
    }
}

and it works fine. As soon as I add another field to the fields parameter, like

{
    "query":{
        "span_multi":{
            "match":{
                "query_string": {
                    "fields": ["field_name", "another_field_name"],
                    "query": "*term*"
                }
            }
        }
    }
}

I get the following error:

spanMultiTerm [match] must be of type multi term query

What am I doing wrong? How could I fix this with the least impact on my original query?

1 Answer 1

1

You need to use multi match query:

{
    "multi_match" : {
      "query":    "*term*", 
      "fields": [ "field_name", "another_field_name" ] 
    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.