Completion fields use the `simple` analyzer by default, which removes
numbers. If you try another analyzer that keeps numbers such as the
standard analyzer, this should work:
PUT /hotels
{
"mappings": {
"hotel" : {
"properties" : {
"name" : { "type" : "string" },
"city" : { "type" : "string" },
"name_suggest" : {
"type" : "completion",
"analyzer": "standard"
}
}
}
}
}
On Tue, Oct 14, 2014 at 2:03 PM, Franck B <[email protected]> wrote:
> Mapping is very basic. There are no analyzers.
>
> Le mardi 14 octobre 2014 13:24:42 UTC+2, Adrien Grand a écrit :
>>
>> You are probably using an analyzer that removes numbers?
>>
>> On Mon, Oct 13, 2014 at 6:45 PM, Franck B <[email protected]> wrote:
>>
>>> Hi all,
>>>
>>> I try to put an auto completion system based on ES.
>>>
>>> This article http://www.elasticsearch.org/blog/you-complete-me/ helps
>>> me a lot, but I don't understand a case:
>>>
>>>
>>>
>>> PUT /hotels
>>>>
>>>> {
>>>>
>>>> "mappings": {
>>>>
>>>> "hotel" : {
>>>>
>>>> "properties" : {
>>>>
>>>> "name_suggest" : {
>>>>
>>>> "type" : "completion"
>>>>
>>>> }
>>>>
>>>> }
>>>>
>>>> }
>>>>
>>>> }
>>>>
>>>> }
>>>>
>>>>
>>>
>>> PUT /hotels/hotel/1
>>>>
>>>> {
>>>>
>>>> "name_suggest" : {
>>>>
>>>> "input" : [
>>>>
>>>> "21 Mercure Hotel Munich",
>>>>
>>>> "24 Mercure Munich"
>>>>
>>>> ]
>>>>
>>>>
>>>>> }
>>>>
>>>> }
>>>>
>>>>
>>>>> PUT hotels/hotel/2
>>>>
>>>> {
>>>>
>>>> "name_suggest" : {
>>>>
>>>> "input" : [
>>>>
>>>> "Monaco Munich",
>>>>
>>>> "Hotel Monaco"
>>>>
>>>> ]
>>>>
>>>> }
>>>>
>>>> }
>>>>
>>>>
>>> When i post :
>>>
>>> POST /hotels/_suggest
>>> {
>>> "hotels" : {
>>> "text" : "m",
>>> "completion" : {
>>> "field" : "name_suggest"
>>> }
>>> }
>>> }
>>>
>>> The result is 3 hotels : "21 Mercure Hotel Munich","24 Mercure
>>> Munich", "Monaco Munich".
>>>
>>>
>>> But when i post this request:
>>>
>>>> POST /hotels/_suggest
>>>>
>>>> {
>>>>
>>>> "hotels" : {
>>>>
>>>> "text" : "2",
>>>>
>>>> "completion" : {
>>>>
>>>> "field" : "name_suggest"
>>>>
>>>> }
>>>>
>>>> }
>>>>
>>>> }
>>>>
>>>>
>>> There is no result ...
>>>
>>> Any Idea ?
>>>
>>>
>>> Franck
>>>
>>>
>>> --
>>> 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/a8094645-39a5-4160-87d8-8a8bd1eca444%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/elasticsearch/a8094645-39a5-4160-87d8-8a8bd1eca444%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Adrien Grand
>>
> --
> 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/f3f2dfbe-ca89-4f30-afe7-f9a9fa8e44c3%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/f3f2dfbe-ca89-4f30-afe7-f9a9fa8e44c3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
Adrien Grand
--
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/CAL6Z4j5ZEn%3DmTj1CW6PywODQz-DgMsOyJwe454GLGqGWi4ZwpA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.