Debugging elasticsearch


(HungryHorace) #1

I've been following a tuturial here:
http://blog.qbox.io/multi-field-partial-word-autocomplete-in-elasticsearch-using-ngrams

but when I query for results I only get matches if i use the entire word.
Partial word searches always give zero results. How do debug this ?

A query for 'aragon' produces matches but 'arango' produces zero
matches...? I'm using 'sense' to submit my queries

POST /tso/geo/_search
{
"size": 10,
"query": {
"match": {
"_all": {
"query": "arago",
"operator": "and"
}
}
}
}

result.
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 0,
"max_score": null,
"hits": []
}
}

--
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/266c1334-0a39-4ce0-b962-8080fa841f98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Michael Lussier) #2

Can you provide your index settings and type mapping?

On Monday, May 5, 2014 3:48:52 PM UTC-5, HungryHorace wrote:

I've been following a tuturial here:

http://blog.qbox.io/multi-field-partial-word-autocomplete-in-elasticsearch-using-ngrams

but when I query for results I only get matches if i use the entire word.
Partial word searches always give zero results. How do debug this ?

A query for 'aragon' produces matches but 'arango' produces zero
matches...? I'm using 'sense' to submit my queries

POST /tso/geo/_search
{
"size": 10,
"query": {
"match": {
"_all": {
"query": "arago",
"operator": "and"
}
}
}
}

result.
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 0,
"max_score": null,
"hits": []
}
}

--
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/5ec140c4-7bbb-4783-95be-49040cc5eb7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(HungryHorace) #3

Hi Michael.

I'm on windows so I'm using sense rather than curl. here are my requests

PUT /travelshopoffers/_settings
{
"analysis": {
"filter": {
"nGram_filter": {
"type": "nGram",
"min_gram": 2,
"max_gram": 20,
"token_chars": [
"letter",
"digit",
"punctuation",
"symbol"
]
}
},
"analyzer": {
"nGram_analyzer": {
"type": "custom",
"tokenizer": "whitespace",
"filter": [
"lowercase",
"asciifolding",
"nGram_filter"
]
},
"whitespace_analyzer": {
"type": "custom",
"tokenizer": "whitespace",
"filter": [
"lowercase",
"asciifolding"
]
}
}
}
}

PUT /travelshopoffers/geo/_mapping
{
"mappings": {
"geo": {
"_all": {
"index_analyzer": "nGram_analyzer",
"search_analyzer": "whitespace_analyzer"
},
"properties": {
"name": {
"type": "string",
"include_in_all": true
},
"lat": {
"type": "string",
"index": "no"
},
"lng": {
"type": "string",
"index": "no"
},
"countryCode": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
},
"countryName": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
}
}
}
}
}

--
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/ff9e6ec7-f77c-4c24-ba06-9b2eef9de9ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Michael Lussier) #4

Assuming the response for the settings and mappings for your cluster are
the same as the requests, and you're expecting "name" to match on "arango".
The reason "arango" isn't partially matching as you're expecting because
"arango" doesn't match any documents in _all.

In the tutorial mentioned, queries are being used to highlight results as
you search. As the example mentions in the tutorial, a query match for
"disn 123 2013" will highlight matching results in the search box.
But using the same tutorial searching for "disnp 123 2013" or "disnp" will
give no results. This tutorial works really well when you're looking to
have a search only find exactly what you search for.

If you're looking to allow for spell checking/errors in your auto-complete,
I suggest looking into the suggesthttp://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters.htmlapi. I hope that makes sense, let me know if I can offer my explanation.

On Tuesday, May 6, 2014 10:50:03 AM UTC-5, HungryHorace wrote:

Hi Michael.

I'm on windows so I'm using sense rather than curl. here are my requests

PUT /travelshopoffers/_settings
{
"analysis": {
"filter": {
"nGram_filter": {
"type": "nGram",
"min_gram": 2,
"max_gram": 20,
"token_chars": [
"letter",
"digit",
"punctuation",
"symbol"
]
}
},
"analyzer": {
"nGram_analyzer": {
"type": "custom",
"tokenizer": "whitespace",
"filter": [
"lowercase",
"asciifolding",
"nGram_filter"
]
},
"whitespace_analyzer": {
"type": "custom",
"tokenizer": "whitespace",
"filter": [
"lowercase",
"asciifolding"
]
}
}
}
}

PUT /travelshopoffers/geo/_mapping
{
"mappings": {
"geo": {
"_all": {
"index_analyzer": "nGram_analyzer",
"search_analyzer": "whitespace_analyzer"
},
"properties": {
"name": {
"type": "string",
"include_in_all": true
},
"lat": {
"type": "string",
"index": "no"
},
"lng": {
"type": "string",
"index": "no"
},
"countryCode": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
},
"countryName": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
}
}
}
}
}

--
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/f9335fdf-b46c-4467-8c59-7e93c639ddde%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(HungryHorace) #5

mmm the tutorial says it does partial word autocomplete which is what i was
looking for and you say it won't do. i'm a little confused here.

i'll check out the suggest api - i hadn't seen that before.

--
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/e5e01242-c0bf-43a9-b177-ccd2e1ce5825%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #6