Re: Exact phrase match - city names example

2014-02-27 Thread thale jacobs
Thanks for the reply Prashy - I tried performing a term query like you 
suggested; I get the same results (all documents containing main are 
returned...E Main St, W Main St...) Do you only get one document returned 
using the example I provided above (doc id 9/Main)??

On Thursday, February 27, 2014 2:25:09 AM UTC-5, Prashy wrote:

 Try using the term query as term query is not analyzed so it might search 
 the 
 exact term only. 

 { 
 query : { 
 term : { street : xxx } 
 } 
 } 



 -- 
 View this message in context: 
 http://elasticsearch-users.115913.n3.nabble.com/Exact-phrase-match-city-names-example-tp4019310p4050604.html
  
 Sent from the ElasticSearch Users mailing list archive at Nabble.com. 


-- 
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/6c5de1e2-b65d-4824-81d5-2e0e9636094d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Exact phrase match - city names example

2014-02-27 Thread Binh Ly
So if I do this:

curl -s -XPUT 'localhost:9200/test' -d '{
  mappings: {
name: {
  properties: {
street: {
  type: string,
  index : not_analyzed
}
  }
}
  }
}

Then I do this:

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] }'

Then I do this:

curl -XGET localhost:9200/test/_search?pretty -d '{
   query:{
  bool:{
 must:[
{
   match:{
  street:{
 query:Main
  }
   }
}
 ]
  }
   }
}

I get back this:

{
  hits : {
hits : [ {
  _index : test,
  _type : name,
  _id : 9,
  _score : 0.30685282, _source : { street: [Main] }
} ]
  }
}

-- 
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/13b6abb4-c58e-44f3-bfad-303b677b5284%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Exact phrase match - city names example

2014-02-27 Thread thale jacobs
I get the same results as you using your example Thanks for posting 
it.  I am not sure why my original example does not work, but that is for 
me to figure out!  Thanks again.

On Thursday, June 14, 2012 2:02:28 PM 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/5ef2e54a-b7b3-4dc6-a4d9-32d2eabb2010%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Exact phrase match - city names example

2014-02-26 Thread thale jacobs
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/42921778-0a92-4a57-ab6f-7f089ebe95ec%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.