# Completion suggest array

**URL:** <https://discuss.elastic.co/t/completion-suggest-array/33720>\
**Category:** Elasticsearch\
**Created:** [November 4, 2015, 9:26am UTC](https://discuss.elastic.co/t/completion-suggest-array/33720 "2015-11-04T09:26:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zaid\_Amir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zaid_amir/32/54679_2.png) [@Zaid\_Amir](https://discuss.elastic.co/u/Zaid_Amir)\
**Post date:** [November 4, 2015, 9:26am UTC](https://discuss.elastic.co/t/completion-suggest-array/33720/1 "2015-11-04T09:26:51Z")

</div>

I have an issue with ES completion suggester. I have the following index mapping:

```
curl -XPUT localhost:9200/test_index/ -d'
{
   "mappings": {
      "item": {
         "properties": {
            "test_suggest": {
               "type": "completion",
               "index_analyzer": "whitespace",
               "search_analyzer": "whitespace",
               "payloads": false
            }
         }
      }
   }
}'

```

I index some names like so:

```
curl -X PUT 'localhost:9200/test_index/item/1?refresh=true' -d '{
    "suggest" : {
        "input": ["John", "Smith"],
        "output": "John Smith",        
        "weight" : 34
    }
}'

curl -X PUT 'localhost:9200/test_index/item/2?refresh=true' -d '{
    "suggest" : {
        "input": ["John", "Doe"],
        "output": "John Doe",        
        "weight" : 34
    }
}'

```

Now if I call suggest and provide only the first name John it works fine:

```
curl -XPOST localhost:9200/test_index/_suggest -d '
{
    "test_suggest":{
        "text":"john",
        "completion": {
            "field" : "test_suggest"
        }
    }
}'

```

Same works for last names:

```
curl -XPOST localhost:9200/test_index/_suggest -d '
    {
        "test_suggest":{
            "text":"doe",
            "completion": {
                "field" : "test_suggest"
            }
        }
    }'

```

Even searching for parts of last or first names work fine:

```
curl -XPOST localhost:9200/test_index/_suggest -d '
    {
        "test_suggest":{
            "text":"sm",
            "completion": {
                "field" : "test_suggest"
            }
        }
    }'

```

However, when I try and search for something that includes part or all of the second word (last name) I get no suggestions, none of the calls below work:

```
curl -XPOST localhost:9200/test_index/_suggest -d '
    {
        "test_suggest":{
            "text":"john d",
            "completion": {
                "field" : "test_suggest"
            }
        }
    }'

   curl -XPOST localhost:9200/test_index/_suggest -d '
        {
            "test_suggest":{
                "text":"john doe",
                "completion": {
                    "field" : "test_suggest"
                }
            }
        }'

curl -XPOST localhost:9200/test_index/_suggest -d '
        {
            "test_suggest":{
                "text":"john smith",
                "completion": {
                    "field" : "test_suggest"
                }
            }
        }'

```

I wonder how can I achieve such a thing without having to put the input a single text field, since I want both to match first and/or last names on completion.

And in case someone is wondering, I am using ES 1.7.2

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:40pm UTC](https://discuss.elastic.co/t/completion-suggest-array/33720/2 "2017-07-05T23:40:41Z")

</div>


