Match query with type vs filter match query with type

I am working on translating my query into a filter for an alias and when I
add a type to the match query I get an error in the filter. My query looks
like this:

curl -X GET 'http://localhost:9200/u1/_search?from=0&size=20&pretty' -d '{
"query": {
"match": {
"_all": {
"query": "T-mobile",
"type": "phrase"
}
}
},
"size": 20,
"from": 0
}'

The filter version of this looks like this:

curl -X GET 'http://localhost:9200/u1/_search?from=0&size=20&pretty' -d '{
"filter": {
"query": {
"match": {
"_all": "T-mobile",
"type": "phrase"
}
}
},
"size": 20,
"from": 0
}'

but I get the following error

QueryParsingException[[statuses] [match] query parsed in simplified form,
with direct field name, but included more options than just the field name,
possibly use its 'options' form, with 'query' element?];

Is there something that I am doing wrong or is it not an option to have the
type in the filter? I want the two to return the same results and the
match with a type of phase give me the results that I am looking for.

Thank you,
Stefanie

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

You're using the simplified match notation in the filter, while using the
extended match nation on the query. The simple notation doesn't support any
options. The following should work:
"filter": {
"query": {
"match": {
"_all": {
"query" : "T-mobile"
"type": "phrase"
}
}
}
}

Alternatively you can use the simple notation with the 'match_phrase' query:
"filter": {
"query": {
"match_phrase": {
"_all": "T-mobile"
}
}
}

With 'match_phrase' type is automatically set to phrase.

On 23 July 2013 19:35, Stefanie stefanie@backstit.ch wrote:

I am working on translating my query into a filter for an alias and when I
add a type to the match query I get an error in the filter. My query looks
like this:

curl -X GET 'http://localhost:9200/u1/_search?from=0&size=20&pretty' -d '{
"query": {
"match": {
"_all": {
"query": "T-mobile",
"type": "phrase"
}
}
},
"size": 20,
"from": 0
}'

The filter version of this looks like this:

curl -X GET 'http://localhost:9200/u1/_search?from=0&size=20&pretty' -d '{
"filter": {
"query": {
"match": {
"_all": "T-mobile",
"type": "phrase"
}
}
},
"size": 20,
"from": 0
}'

but I get the following error

QueryParsingException[[statuses] [match] query parsed in simplified form,
with direct field name, but included more options than just the field name,
possibly use its 'options' form, with 'query' element?];

Is there something that I am doing wrong or is it not an option to have
the type in the filter? I want the two to return the same results and the
match with a type of phase give me the results that I am looking for.

Thank you,
Stefanie

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Met vriendelijke groet,

Martijn van Groningen

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.