Question about refining search

Im trying to build some search capability that will be used in an mobile
app. Being new to ES I'm having problems getting the correct search
results.
I'm storing text like:

"I am an iPhone developer. I am looking for work for the next year. I am
willing to travel"
"Experienced Oracle DBA, willing to travel for work. I have about 5 years
experience in DBA.."

"I am the super duper developer with massive amounts of experience. Call me
for all work."

When I do a search like "Iphone developer" I get all three matches back
even though the second has Oracle and nothing to do with Iphone.

Here is my Index and mappings along with query

curl -XPUT localhost:9200/providing/ -d '
{"index":
{ "number_of_shards": 1,
"analysis": {
"filter": {
"mynGram" : {"type": "nGram", "min_gram": 2, "max_gram":
10}
},
"analyzer": { "my_anal" : {
"type":"custom",
"tokenizer": "standard",
"filter": ["lowercase","stop","mynGram"]
}
}
}
}
}
}'

curl -XPUT localhost:9200/providing/post_prov/_mapping -d '{
"post_prov" : {
"index_analyzer" : "my_anal",
"search_analyzer" : "my_anal",
"properties" : {
"descr": {"type":"string", "analyzer":"standard"}
}
}}'

My query is:

curl -XGET 'http://localhost:9200/providing/post_prov/_search?pretty=true'
-d '{ "query" : { "query_string" : { "descr" : { "query" : "ipone
developer" } } } }'

Any help would be appreciated, again I'm very new so if I've done something
stupid, go easy on me

Thanks

The default operator for a query_string query is OR:

Still not sure why the second document is being matched on, but try
simpler analyzers first before optimizing with ngrams. Besides, with
ngrams, it is often best to not apply an ngram analyzer on the search
string against a field that has been analyzed since you might get
false positives between query strings with the same prefix.

--
Ivan

On Fri, Jul 20, 2012 at 3:49 PM, Linton trlinton@gmail.com wrote:

Im trying to build some search capability that will be used in an mobile
app. Being new to ES I'm having problems getting the correct search
results.
I'm storing text like:

"I am an iPhone developer. I am looking for work for the next year. I am
willing to travel"
"Experienced Oracle DBA, willing to travel for work. I have about 5 years
experience in DBA.."

"I am the super duper developer with massive amounts of experience. Call me
for all work."

When I do a search like "Iphone developer" I get all three matches back even
though the second has Oracle and nothing to do with Iphone.

Here is my Index and mappings along with query

curl -XPUT localhost:9200/providing/ -d '
{"index":
{ "number_of_shards": 1,
"analysis": {
"filter": {
"mynGram" : {"type": "nGram", "min_gram": 2, "max_gram":
10}
},
"analyzer": { "my_anal" : {
"type":"custom",
"tokenizer": "standard",
"filter": ["lowercase","stop","mynGram"]
}
}
}
}
}
}'

curl -XPUT localhost:9200/providing/post_prov/_mapping -d '{
"post_prov" : {
"index_analyzer" : "my_anal",
"search_analyzer" : "my_anal",
"properties" : {
"descr": {"type":"string", "analyzer":"standard"}
}
}}'

My query is:

curl -XGET 'http://localhost:9200/providing/post_prov/_search?pretty=true'
-d '{ "query" : { "query_string" : { "descr" : { "query" : "ipone developer"
} } } }'

Any help would be appreciated, again I'm very new so if I've done something
stupid, go easy on me

Thanks

Thanks Ivan,

Is there anyway to "loosen" ,if you will, the default_operator of "and".
My match works but if I change my query to
"looking for iphone developer" I only get one hit when I should get 2 based
on the following 2 stored sentences:

"iPhone developer available for hire."
"I am an iPhone developer. I am looking for work for the next year. I am
willing to travel."

I have not simplified the analyzer. Would that help this issue?

On Friday, July 20, 2012 6:27:51 PM UTC-5, Ivan Brusic wrote:

The default operator for a query_string query is OR:

Elasticsearch Platform — Find real-time answers at scale | Elastic

Still not sure why the second document is being matched on, but try
simpler analyzers first before optimizing with ngrams. Besides, with
ngrams, it is often best to not apply an ngram analyzer on the search
string against a field that has been analyzed since you might get
false positives between query strings with the same prefix.

--
Ivan

On Fri, Jul 20, 2012 at 3:49 PM, Linton trlinton@gmail.com wrote:

Im trying to build some search capability that will be used in an mobile
app. Being new to ES I'm having problems getting the correct search
results.
I'm storing text like:

"I am an iPhone developer. I am looking for work for the next year. I am
willing to travel"
"Experienced Oracle DBA, willing to travel for work. I have about 5
years
experience in DBA.."

"I am the super duper developer with massive amounts of experience. Call
me
for all work."

When I do a search like "Iphone developer" I get all three matches back
even
though the second has Oracle and nothing to do with Iphone.

Here is my Index and mappings along with query

curl -XPUT localhost:9200/providing/ -d '
{"index":
{ "number_of_shards": 1,
"analysis": {
"filter": {
"mynGram" : {"type": "nGram", "min_gram": 2,
"max_gram":
10}
},
"analyzer": { "my_anal" : {
"type":"custom",
"tokenizer": "standard",
"filter": ["lowercase","stop","mynGram"]
}
}
}
}
}
}'

curl -XPUT localhost:9200/providing/post_prov/_mapping -d '{
"post_prov" : {
"index_analyzer" : "my_anal",
"search_analyzer" : "my_anal",
"properties" : {
"descr": {"type":"string", "analyzer":"standard"}
}
}}'

My query is:

curl -XGET '
http://localhost:9200/providing/post_prov/_search?pretty=true'
-d '{ "query" : { "query_string" : { "descr" : { "query" : "ipone
developer"
} } } }'

Any help would be appreciated, again I'm very new so if I've done
something
stupid, go easy on me

Thanks