ElasticSearch not able to find documents which contains the searched text

Hi,

I have following mapping:

curl -XPUT 'http://localhost:9200/acqindex/' -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 1,
"analysis" : {
"analyzer" : {
"str_search_analyzer" : {
"tokenizer" : "standard",
"filter" :
["lowercase","asciifolding","suggestions_shingle","edgengram"]
},
"str_index_analyzer" : {
"tokenizer" : "standard",
"filter" :
["lowercase","asciifolding","suggestions_shingle","edgengram"]
}
},
"filter" : {
"suggestions_shingle": {
"type": "shingle",
"min_shingle_size": 2,
"max_shingle_size": 5
},
"edgengram" : {
"type" : "edgeNGram",
"min_gram" : 2,
"max_gram" : 30,
"side" : "front"
}
}
}
}
}
}'

Also, Following data is indexed in ElasticSearch:-

curl -XPUT 'localhost:9200/acqindex/acqidx/1' -d '{ text:"Hotels in Hoscur"
}',
curl -XPUT 'localhost:9200/acqindex/acqidx/2' -d '{ text:"Hotels in
innsburg" }'
curl -XPUT 'localhost:9200/acqindex/acqidx/3' -d '{ text:"Hotels in ink" }'
curl -XPUT 'localhost:9200/acqindex/acqidx/4' -d '{ text:"Hotels in
houston" }'
curl -XPUT 'localhost:9200/acqindex/acqidx/4' -d '{ text:"Hotels in
darjeling" }'
curl -XPUT 'localhost:9200/acqindex/acqidx/5' -d '{ text:"Hotels in darjel"
}'
curl -XPUT 'localhost:9200/acqindex/acqidx/6' -d '{ text:"Hotels in india"
}'

Now, if I query like this:

curl -XGET localhost:9200/acqindex/_search -d '{
"query": {
"query_string" : {
"query": "hotel"
}
}
}'

It is not able to find any document. But my index analyzer generates
"hotel" as one of the token. So, why ElasticSearch is not able to find
above listed documents.

Also, I have other doubts regarding ElasticSearch Query mechanism:

  1. Whenever I query for "hotels" ElasticSearch gives me all the above
    listed docs but the order is somewhat biased towards more such docs which
    contains greater occurrences of "ho" or "in". Is it like ElasticSearch
    gives more weightage to docs where the no. of tokens of a particular type
    like "ho" is more ?

  2. Also, sometimes when I search in ElasticSearch, it don't give me those
    docs on the top which have exact same text phrase. In fact, it keeps
    showing other docs which contains some extraneous text words. How can I
    tackle this problem. I can't search for exact user typed text phrase since
    there are many ways to query a single thing. I want to search all the docs
    that can be possible matches but somehow I want my results to be biased
    towards docs which contains exact phrases on the top and rest of the
    matches to be in the bottom. for eg, if I search for hotel oberoi in delhi

then I want results like:

hotel oberoi in delhi
hotel oberoi
hotel in delhi
hotels in delhi

  1. Is there any query type which are generally used for autocompleters
    which are based on ElasticSearch. Or, if anyone has a better idea of
    querying in ElasticSearch.

  2. Is there anything like a machine learning in query mechanism so that I
    can understand what user wants while typing so that I can give better
    results.

I really like ElasticSearch but it's giving me a hell lot of problem
implementing Autocompleter.

How can I modify my index and search analyzers for better results.

PS : I'm using ElasticSearch-0.90.3 and right now I can't move to latest
version.

Please help with the above stuff guys.

Thanks

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4c86a60e-fef6-4215-a3cd-64f0845fb8e1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

You search for "hotel", but in the index, you have "Hotels".

Note, you did not configure a mapping. Setting is there, but mapping is
missing.

Also, with a query_string search "hotel", you search in the _all field, so
you should align your query with the field you use for indexing (the 'text'
field).

Jörg

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEBidh3acA7Aer4B6tfGxtVXjh_b2aXSQg8FfyfpfY9aQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Accept my apology. I forgot to post my mapping:

{"acqindex":{"acqidx":{"properties":{"text":{"type":"string","index_analyzer":"str_index_analyzer","search_analyzer":"str_search_analyzer"}}}}}

I'll try my query with fields option and will get back to you. Just
one question, why it is able to search for hotels then. If I search
for hotels then Elasticsearch is giving me results as expected.

Also,Can you clear my other doubts which I mentioned above. I'll be
thankful to you.

Thanks

On Fri, Jan 31, 2014 at 9:15 PM, joergprante@gmail.com <
joergprante@gmail.com> wrote:

You search for "hotel", but in the index, you have "Hotels".

Note, you did not configure a mapping. Setting is there, but mapping is
missing.

Also, with a query_string search "hotel", you search in the _all field, so
you should align your query with the field you use for indexing (the 'text'
field).

Jörg

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEBidh3acA7Aer4B6tfGxtVXjh_b2aXSQg8FfyfpfY9aQ%40mail.gmail.com
.

For more options, visit https://groups.google.com/groups/opt_out.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAAVTvp5%2BmpnXARTZZQh2UgVAjx%2BucMdzQAELsAMhLoy0VvL2ew%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Using fields in query_string worked but still other problems which I
meantioned earlier remains unsolved.

On Fri, Jan 31, 2014 at 9:21 PM, Mukul Gupta mukulnitkkr@gmail.com wrote:

Accept my apology. I forgot to post my mapping:

{"acqindex":{"acqidx":{"properties":{"text":{"type":"string","index_analyzer":"str_index_analyzer","search_analyzer":"str_search_analyzer"}}}}}

I'll try my query with fields option and will get back to you. Just one question, why it is able to search for hotels then. If I search for hotels then Elasticsearch is giving me results as expected.

Also,Can you clear my other doubts which I mentioned above. I'll be thankful to you.

Thanks

On Fri, Jan 31, 2014 at 9:15 PM, joergprante@gmail.com <
joergprante@gmail.com> wrote:

You search for "hotel", but in the index, you have "Hotels".

Note, you did not configure a mapping. Setting is there, but mapping is
missing.

Also, with a query_string search "hotel", you search in the _all field,
so you should align your query with the field you use for indexing (the
'text' field).

Jörg

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEBidh3acA7Aer4B6tfGxtVXjh_b2aXSQg8FfyfpfY9aQ%40mail.gmail.com
.

For more options, visit https://groups.google.com/groups/opt_out.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAAVTvp7vNEzbR8RZ7j3u2vgZbMj2zgdrVnL6qYapmihkfTPbiw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.