# Phrase suggestion not returning any values

**URL:** <https://discuss.elastic.co/t/phrase-suggestion-not-returning-any-values/77696>\
**Category:** Elasticsearch\
**Created:** [March 7, 2017, 4:17pm UTC](https://discuss.elastic.co/t/phrase-suggestion-not-returning-any-values/77696 "2017-03-07T16:17:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![christer.n](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christer.n/32/15539_2.png) [@christer.n](https://discuss.elastic.co/u/christer.n)\
**Post date:** [March 7, 2017, 4:17pm UTC](https://discuss.elastic.co/t/phrase-suggestion-not-returning-any-values/77696/1 "2017-03-07T16:17:12Z")

</div>

Hi there, im trying to get a phrase suggester to work - So far, im not very successfull!

I basically followed the guide in the docs - [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters-phrase.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters-phrase.html)

with a few differences:  
title.trigram = title.suggest

Heres are some documents to show you some structure \ expected results:

```
{
    "_index": "myIndex",
    "_type": "article",
    "_id": "b5893c47-7bbc-4eb1-b96e-3d621639d591",
    "_score": 0.71896636,
    "_source": {
        "title": "Alloy Meet"
    }
},
    {
    "_index": "myIndex",
    "_type": "article",
    "_id": "8b2eafb2-c8d5-41d0-a561-a525d42a38b2",
    "_score": 0.6925415,
    "_source": {
        "title": "Enhances Risk Management"
    }
},
    {
    "_index": "myIndex",
    "_type": "article",
    "_id": "673903fe-8562-4c46-9cca-b90dd6ed41e2",
    "_score": 0.6597031,
    "_source": {
        "title": "Alloy Saves Bears"
    }
},
    {
    "_index": "myIndex",
    "_type": "article",
    "_id": "30f44007-6cea-4d4d-b730-07f006f5dcdf",
    "_score": 0.61461323,
    "_source": {
        "title": "Download Alloy Track"
    }
},
{
    "_index": "myIndex",
    "_type": "article",
    "_id": "1c4af28b-fb26-42e5-8d8e-cc3dbe72d2f6",
    "_score": 0.61090285,
    "_source": {
        "title": "Alloy Track"
    }
},

```

## Backend code

- Settings up the index template - This seems to work properly when inspecting the mapping:

## The search, done in Kibana:

```
POST /myIndex/_search
{
  "suggest": {
    "text" : "all meet",
    "simple_phrase" : {
      "phrase" : {
        "field" : "title.suggest",
        "real_word_error_likelihood": 0.10,
        "size" : 5,
        "direct_generator" : [ {
          "field" : "title.suggest",
          "suggest_mode" : "always",
          "min_word_length" : 1
        } ],
        "collate": {
          "query": { 
            "inline" : {
              "match": {
                "{{field_name}}" : "{{suggestion}}" 
              }
            }
          },
          "params": {"field_name" : "title"}, 
          "prune": true 
        }
      }
    }
  }
}

```

## Search Response

```
{
  "took": 2,
  "timed_out": false,
  "_shards": {
    "total": 15,
    "successful": 15,
    "failed": 0
  },
  "hits": {
    "total": 0,
    "max_score": 0,
    "hits": []
  },
  "suggest": {
    "simple_phrase": [
      {
        "text": "all meet",
        "offset": 0,
        "length": 8,
        "options": []
      }
    ]
  }
}

```

## Expected result:

I would expect **"all"** to be corrected to **"alloy"**

Appreciate any help!

---

<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:** [April 4, 2017, 4:17pm UTC](https://discuss.elastic.co/t/phrase-suggestion-not-returning-any-values/77696/2 "2017-04-04T16:17:15Z")

</div>

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