Search pattern with a forward slash


(felix07059) #1

Hi,

I have a set of data setting in elasticsearch, like
{"symbol":"AUD/USD"},{"symbol":"HKD/USD"},{"symbol":"AUD/EUR"}... I would
like to search for "AUD/USD". So the search query string will be "{
"bool":{ "must":{ "query_string":{ "query":"(symbol:AUD/USD)" } } } }". But
the result I got looks that ES used "/" (forward slash) to search any
symbol having "AUD" or "USD" instead of "AUD/USD". I tried with "\/" and I
got a same result.

thanks,
Felix

--
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/f5ec93b6-f847-467c-8ab6-3b51d77ce499%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Dan Tuffery) #2

Make it a phrase query:

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

or with the query_string:

{
"bool": {
"must": {
"query_string": {
"query": "(symbol:"AUD/USD")"
}
}
}
}

Dan
On Tuesday, April 15, 2014 4:04:21 PM UTC+1, felix...@gmail.com wrote:

Hi,

I have a set of data setting in elasticsearch, like
{"symbol":"AUD/USD"},{"symbol":"HKD/USD"},{"symbol":"AUD/EUR"}... I would
like to search for "AUD/USD". So the search query string will be "{
"bool":{ "must":{ "query_string":{ "query":"(symbol:AUD/USD)" } } } }". But
the result I got looks that ES used "/" (forward slash) to search any
symbol having "AUD" or "USD" instead of "AUD/USD". I tried with "\/" and I
got a same result.

thanks,
Felix

--
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/ec964f9b-932f-4404-a9a1-58f11b748d86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3