Multi text string search


(Linton) #1

Hi Im trying to create a query that searches through some documents with varying text. Lets say there are 2 different documents similar to below

curl -XPUT 'http://localhost:9200/providing/post_prov/2' -d '{"userid":"100","docid":"12","key_words":"Experienced Oracle DBA, willing to travel for work. I have about 5 years experience as a DBA.." }';

curl -XPUT 'http://localhost:9200/providing/post_prov/5' -d '{"userid":"120","docid":"44","key_words":"iPhone developer available for hire." }';

I would like to create one query that searches for text that would match both of the above documents but process them independently. I've come close but still new to ES and learning the ropes. The problem seems to be that the minimum_should_match is not being evaluated per each query_string query. I know they are within a filter and that may not be the correct way to structure the query

The goal here is to submit mutiple searches within one query to create more efficient processing. But if one document has "oracle developer" and another "Iphone developer"; A search for "oracle developer" and another for "Iphone" should only return 1 result because each query has a minimum_should_match set to 2. See my current query below I may be going about this the wrong way

curl -XGET 'http://localhost:9200/providing/post_prov/_search?retty=true' -d '
{
"query":{
"filtered" : {
"query" : {
"terms" : {"userid":[120,100,110,130,150]}
},
"filter" : {
"or" : {
"filters" : [
{"query": {"query_string" :{"query": "iphone developer","analyzer":"snowball","minimum_should_match":"2"}}},
{"query": {"query_string" :{"query": "oracle dba","analyzer":"snowball","minimum_should_match":"2"}}}
]
}
}
}
}
}'

Thanks
Todd


(Linton) #2

Actually it is working correctly, sorry for the post


(system) #3