ES 6.X C reate a match query that queries a string array


(Miguel Ángel) #1

Hello all,

I'm trying to refactor a ES 1.7 query that uses a match query that queries a string array into a ES 6.X query.

Here is the query in 1.7:

{
    "query": {
        "bool": {
        	"must": {
        		"match": {
        			"name": {
        				"query": ["name1","name2"],
        				"operator" : "and"
        			}
        		}
        	}
        }
    }
}

But in ES 6.X this query doesn't work, throwing this exception: [match] unknown token [START_ARRAY] after [query].

So, what would be the best way to transform this query in EX 6.X? What I wouldto do is a match query that queries in field "name" a list of values, in this case "name1 and "name2".

Don't hesitate to correct the query, because I don't know if the 1.7 query is well-formed.

Thanks in advance!

Regards,
Miguel.


(system) #2

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