# Getting a specific term / phrase suggestion

**URL:** <https://discuss.elastic.co/t/getting-a-specific-term-phrase-suggestion/227140>\
**Category:** Elasticsearch\
**Created:** [April 8, 2020, 1:54pm UTC](https://discuss.elastic.co/t/getting-a-specific-term-phrase-suggestion/227140 "2020-04-08T13:54:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![elastic7](https://avatars.discourse-cdn.com/v4/letter/e/9de053/32.png) [@elastic7](https://discuss.elastic.co/u/elastic7)\
**Post date:** [April 8, 2020, 1:54pm UTC](https://discuss.elastic.co/t/getting-a-specific-term-phrase-suggestion/227140/1 "2020-04-08T13:54:28Z")

</div>

I am looking to get a specific set of results from a suggester. I am indexing a bunch of documents that have keywords like the following:

```
"shop in berlin"
"restaurant in frankfurt"

```

When the user enters a search term like

```
"shop berlin"

```

I would like to get

```
"shop in berlin"

```

as a suggestion.

My current mapping is as follows:

```
    "filter": {
  "shingle_filter": {
    "max_shingle_size": "3",
    "min_shingle_size": "2",
    "type": "shingle"
    }
  },
  
  "analyzer": {
    "did_you_mean_analyzer": {
    "filter": [
      "lowercase", "shingle_filter"
    ],

    "type": "custom",
    "tokenizer": "keyword"
  },

```

When sending the query with

```
  "suggest": {
"simple_phrase": {
  "text": "shop berlin",
  "phrase": {
      "field": "suggest.did_you_mean",
      "max_errors": 3
    }
  }
},

```

no suggestions are being returned. However, if I add an extra whitespace between "shop" and "berlin" in the query it returns the correct suggestion: `shop in berlin`:

```
  "suggest": {
"simple_phrase": {
  "text": "shop berlin",
  "phrase": {
      "field": "suggest.did_you_mean",
      "max_errors": 3
    }
  }
},

```

Increasing the max\_errors parameter does not help. Is this even the right approach for this case? Essentially I am looking to get existing multi-word keywords as suggestion which have an similarity to the users input.

---

<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:** [May 6, 2020, 1:54pm UTC](https://discuss.elastic.co/t/getting-a-specific-term-phrase-suggestion/227140/2 "2020-05-06T13:54:40Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
