REST vs URL searching - what's the difference in this query?


(James Green) #1

This works in a browser and finds tens of thousands of records:

http://localhost:9200/accountevents/_search?q=Medium:SMS

This cmd finds nothing:

curl -XGET 'http://localhost:9200/accountevents/_search' -d '{
"query": {
"term": {
"Medium": "SMS"
}
}
}'

We can't work out what the difference is. Can someone point it out to us?

Thanks,

James

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/d4b85b87-8b79-4faa-82f1-d4706f1616e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Jörg Prante) #2

You are using a query_string query in the first query, and a term query in
the second query.

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-dsl-query-string-query

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-term-query.html#query-dsl-term-query

Instead of a term query you might want to use a match query, because this
works on analyzed fields.

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#query-dsl-match-query

Jörg

On Mon, Jul 14, 2014 at 1:48 PM, James Green james.mk.green@gmail.com
wrote:

This works in a browser and finds tens of thousands of records:

http://localhost:9200/accountevents/_search?q=Medium:SMS

This cmd finds nothing:

curl -XGET 'http://localhost:9200/accountevents/_search' -d '{
"query": {
"term": {
"Medium": "SMS"
}
}
}'

We can't work out what the difference is. Can someone point it out to us?

Thanks,

James

--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/d4b85b87-8b79-4faa-82f1-d4706f1616e5%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/d4b85b87-8b79-4faa-82f1-d4706f1616e5%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoFuV6A%2BhjR543KBNz%3DzhVN84erxYppdJp9Mk25OVY77zg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3