Thanks for the reply Binh Ly - I think the mapping in your example are almost like the example I posted and I believe are functionality the equivalent. But my query against the not_analyzed fields return all the docs with the word "Main" in them....From the query side I also thought I could specify "analyzer" : "keyword"...but also get the same results...but yes, your are correct in something seems off as I can query and the case of the search term does not seem to impact the results so that is telling me a search analyzer is being used???
On Wednesday, February 26, 2014 5:12:02 PM UTC-5, Binh Ly wrote: > 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 elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/5f94aca2-1754-4358-9be7-f763b671fc48%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.