Match query in a filter

I am working on translating a match query into a filter and was not having
a problem until I added a type.

My query looks like this and runs fine:

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

but when I try to run it as a filter 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
}'

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?]

This only happens once I add the type option. Can I not do this in filters?

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.

Hey,

your query seems not to be constructed correctly (see
Elasticsearch Platform — Find real-time answers at scale | Elastic)

Either you do (the field name opens a new JSON object containing query and
type):

"query" : { "match" : { "_all": { "query":"T-Mobile", "type":"phrase" } } }

or you do the short version

"query" : { "match_phrase" : { "_all": "T-Mobile" } }

Hope this helps

--Alex

On Tue, Jul 23, 2013 at 10:55 PM, Stefanie stefanie@backstit.ch wrote:

I am working on translating a match query into a filter and was not having
a problem until I added a type.

My query looks like this and runs fine:

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

but when I try to run it as a filter 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
}'

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?]

This only happens once I add the type option. Can I not do this in
filters?

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 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.

Thank you. Thank is what I was doing wrong.

Stefanie

On Tuesday, July 23, 2013 4:55:48 PM UTC-4, Stefanie wrote:

I am working on translating a match query into a filter and was not having
a problem until I added a type.

My query looks like this and runs fine:

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

but when I try to run it as a filter 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
}'

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?]

This only happens once I add the type option. Can I not do this in
filters?

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.