Thale,
Can you double check the mapping. Something seems off to me. Should be
something like this:
{
"mappings": {
"name": {
"properties": {
"street": {
"type": "string",
"index" : "not_analyzed"
}
}
}
}
}
And don't forget, not_analyzed means case-sensitive matches, fyi. :)
On Wednesday, February 26, 2014 4:51:40 PM UTC-5, thale jacobs wrote:
>
> I am having problem a similar problem too. Here is how I set it up the
> test index:
>
> Create the index:
> curl -s -XPUT 'localhost:9200/test' -d '{
> "mappings": {
> "properties": {
> "name": {
> "street": {
> "type": "string",
> "index_analyzer": "not_analyzed",
> "search_analyzer": "not_analyzed",
> "index" : "not_analyzed"
> }
> }
> }
> }
> }'
>
>
>
> Inert some data:
> curl -s -XPUT 'localhost:9200/test/name/5' -d '{ "street": ["E Main St"]}'
> curl -s -XPUT 'localhost:9200/test/name/6' -d '{ "street": ["W Main St"]
> }'
> curl -s -XPUT 'localhost:9200/test/name/7' -d '{ "street": ["East Main
> Rd"] }'
> curl -s -XPUT 'localhost:9200/test/name/8' -d '{ "street": ["West Main
> Rd"] }'
> curl -s -XPUT 'localhost:9200/test/name/9' -d '{ "street": ["Main"] }'
> curl -s -XPUT 'localhost:9200/test/name/10' -d '{ "street": ["Main St"] }'
>
>
>
>
> --Now attempt to search for "Main"... Not "Main St", Not "East Main
> Rd"...I only want to return doc #9 - "Main"
> curl -s -XGET 'localhost:9200/test/_search?pretty=true' -d '{
> "query":{
> "bool":{
> "must":[
> {
> "match":{
> "street":{
> "query":"main",
> "type":"phrase",
> "analyzer" : "keyword"
> }
> }
> }
> ]
> }
> }
> }';
>
> The best document returned is "Main", but I don't know how to filter out
> the others that are not exact matches (although they contain matching
> terms).
> ...
> Here the results from my example above:
> "_score" : 0.2876821, "_source" : { "street": ["Main"] }
> "_score" : 0.25316024, "_source" : { "street": ["East Main Rd"] }
> "_score" : 0.25316024, "_source" : { "street": ["W Main St"] }
> "_score" : 0.25316024, "_source" : { "street": ["E Main St"]}
> "_score" : 0.1805489, "_source" : { "street": ["Main St"] }
> "_score" : 0.14638957, "_source" : { "street": ["West Main Rd"] }
>
>
>
>
>
> On Thursday, June 14, 2012 3:38:31 PM UTC-4, Colin Dellow wrote:
>>
>> Does "index": "not_analyzed" not work for you (
>> http://www.elasticsearch.org/guide/reference/mapping/core-types.html) ?
>>
>>
>> On Thursday, 14 June 2012 14:02:28 UTC-4, Greg Silin wrote:
>>>
>>> Hi,
>>> One of our fields in the index stores city names, and we need to ensure
>>> that the term is matched exactly.
>>>
>>> So if we have "san francisco" indexed, we need to ensure that *only* the
>>> term "san francisco" matches; "san" or "francisco" or "south san francisco"
>>> should all be misses.
>>>
>>> In particular, I don't have a solution on how to make sure "san
>>> francisco" does not match against "south san francisco"
>>>
>>> Thanks
>>> -greg
>>>
>>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/be851b91-7355-4d11-bac6-20ff321611d3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.