I've solved it, simple really, but maybe a bug?

Instead of:

PUT restaurants/restaurant/_mapping
{
    "location": {
        "index_analyzer": "whitespace",
        "search_analyzer": "whitespace", 
        "properties": {
            "name_suggest": {
                "type": "completion",
                "payloads": true
            }
        }
    }
}

I now have:

PUT restaurants/restaurant/_mapping
{
    "location": {
        "properties": {
            "name_suggest": {
                "type": "completion",
                "index_analyzer": "whitespace",
                "search_analyzer": "whitespace",
                "payloads": true
            }
        }
    }
}


On Wednesday, January 29, 2014 11:30:48 AM UTC, Michael Wallett wrote:
>
> Hi,
>
> I'm using the Suggest API to create an autocomplete for restaurant names, 
> but I've run into a small problem. Some restaurant names start with 
> numbers, for example:
>
> 68 - 86 Bar & Restaurant
>
> I want to be able to type 68 and get the restaurant back. I've tried using 
> the whitespace analyzer, but it doesn't fix my issue.
>
> Here is the analyze output for the restaurant name: 
>
>
> {"tokens":[{"token":"68","start_offset":0,"end_offset":2,"type":"<NUM>","position":1},{"token":"86","start_offset":5,"end_offset":7,"type":"<NUM>","position":2},{"token":"bar","start_offset":8,"end_offset":11,"type":"<ALPHANUM>","position":3},{"token":"restaurant","start_offset":14,"end_offset":24,"type":"<ALPHANUM>","position":4}]}
>  
>
> Here are the commands to reproduce my issue:
>
> PUT restaurants
> { }
>
> PUT restaurants/restaurant/_mapping
> {
>     "location": {
>         "index_analyzer": "whitespace",
>         "search_analyzer": "whitespace", 
>         "properties": {
>             "name_suggest": {
>                 "type": "completion",
>                 "payloads": true
>             }
>         }
>     }
> }
>
> POST restaurants/restaurant/1
> {
>     "name_suggest": {
>         "input": [
>             "68 - 86 Bar & Restaurant"
>         ],
>         "output": "68 - 86 Bar & Restaurant",
>         "payload": { 
>             "id": 1067
>         }
>     }
> }
>
> POST restaurants/_suggest
> {
>     "suggestions": {
>         "text": "68 - 86",
>         "completion": {
>             "field": "name_suggest"
>         }
>     }
> }
>
> I don't get any results from _suggest. Any help would be appreciated.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/82861b74-f888-4389-9a69-8801cb8d9400%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to