# Why analyser dont work with suggester?

**URL:** <https://discuss.elastic.co/t/why-analyser-dont-work-with-suggester/374827>\
**Category:** Elasticsearch\
**Created:** [February 20, 2025, 4:58pm UTC](https://discuss.elastic.co/t/why-analyser-dont-work-with-suggester/374827 "2025-02-20T16:58:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adrien\_L](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adrien_l/32/141523_2.png) [@Adrien\_L](https://discuss.elastic.co/u/Adrien_L)\
**Post date:** [February 20, 2025, 4:58pm UTC](https://discuss.elastic.co/t/why-analyser-dont-work-with-suggester/374827/1 "2025-02-20T16:58:12Z")

</div>

I'm trying to work on a basic suggester that if someone write "bl" the suggester would propose "blue corola" and "toyota blue". But at the moment its only return "blue corola". It's like the analyser dont work.  
Can you help me to find what I am missing

```auto
PUT /my-index-000001
{
  "settings": {
    "analysis": {
      "analyzer": {
        "custom_analyzer": {
          "type": "custom",
          "tokenizer": "whitespace",
          "filter": ["lowercase"]
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "color": {
        "type": "completion",
        "analyzer": "custom_analyzer",
        "search_analyzer": "standard"
      }
    }
  }
}

POST /my-index-000001/_doc/1
{
  "color": ["toyota blue"]
}

POST /my-index-000001/_doc/2
{
  "color": ["toyota blue"]
}

POST /my-index-000001/_doc/3
{
  "color": ["blue corola"]
}

POST /my-index-000001/_search
{
  "suggest": {
    "my-suggestion": {
      "text": "bl",
      "completion": {
        "field": "color",
        "skip_duplicates": "false"
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [February 21, 2025, 4:26pm UTC](https://discuss.elastic.co/t/why-analyser-dont-work-with-suggester/374827/2 "2025-02-21T16:26:20Z")

</div>

Hi @Adrien_L Welcome!

Try to separate the terms in indexing.

Doc: [Suggesters | Elasticsearch Guide [7.17] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/search-suggesters.html#indexing)

```auto
POST /my-index-000001/_doc/1
{
  "color": ["toyota", "blue"]
}

POST /my-index-000001/_doc/2
{
  "color": ["toyota", "blue"]
}

POST /my-index-000001/_doc/3
{
  "color": ["blue", "corola"]
}

```

---

<div class="post-metadata">

**Author:** ![Adrien\_L](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adrien_l/32/141523_2.png) [@Adrien\_L](https://discuss.elastic.co/u/Adrien_L)\
**Post date:** [February 25, 2025, 5:01pm UTC](https://discuss.elastic.co/t/why-analyser-dont-work-with-suggester/374827/3 "2025-02-25T17:01:33Z")

</div>

Thank you @RabBit_BR !  
Okay so yes, it works with your manual splitting technique but ideally, I would like to use Elasticsearch tokenizer and not do it manually. As you can see I set:  
`"tokenizer": "whitespace"`  
so I' m guessing it already created an index with each word tokenize and ready to be returned for my suggestion no?
