# Issue with Suggester

**URL:** <https://discuss.elastic.co/t/issue-with-suggester/110400>\
**Category:** Elasticsearch\
**Created:** [December 5, 2017, 5:43pm UTC](https://discuss.elastic.co/t/issue-with-suggester/110400 "2017-12-05T17:43:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Akshay\_Deep\_Lamba](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Akshay\_Deep\_Lamba](https://discuss.elastic.co/u/Akshay_Deep_Lamba)\
**Post date:** [December 5, 2017, 5:43pm UTC](https://discuss.elastic.co/t/issue-with-suggester/110400/1 "2017-12-05T17:43:31Z")

</div>

Hi

Below are the Details:-

```
GET /books1/_mapping 

{
  "books1": {
    "mappings": {
      "book": {
        "properties": {
          "author": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "language": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "publishYear": {
            "type": "long"
          },
          "summary": {
            "type": "text",
            "fields": {
              "reverse": {
                "type": "text",
                "analyzer": "reverse"
              },
              "trigram": {
                "type": "text",
                "analyzer": "trigram"
              }
            }
          },
          "title": {
            "type": "text",
            "fields": {
              "reverse": {
                "type": "text",
                "analyzer": "reverse"
              },
              "trigram": {
                "type": "text",
                "analyzer": "trigram"
              }
            }
          }
        }
      }
    }
  }
}

```

> GET /books1/\_settings

```
{
      "books1": {
        "settings": {
          "index": {
            "number_of_shards": "1",
            "provided_name": "books1",
            "creation_date": "1512494128646",
            "analysis": {
              "filter": {
                "shingle": {
                  "max_shingle_size": "3",
                  "min_shingle_size": "2",
                  "type": "shingle"
                }
              },
              "analyzer": {
                "reverse": {
                  "filter": [
                    "standard",
                    "reverse"
                  ],
                  "type": "custom",
                  "tokenizer": "standard"
                },
                "trigram": {
                  "filter": [
                    "standard",
                    "shingle"
                  ],
                  "type": "custom",
                  "tokenizer": "standard"
                }
              }
            },
            "number_of_replicas": "1",
            "uuid": "T2WwwsoIRhm-n88MpQ_tug",
            "version": {
              "created": "5060399"
            }
          }
        }
      }
    }

```

Below is the search suggest query \>\>

```
POST /books1/_search
{
  "suggest": {
    "text" : "Jave programing",
    "simple_phrase" : {
      "phrase" : {
        "field" : "summary.trigram",
        "size" : 4,
        "max_errors":3,
        "direct_generator" : [ {
          "field" : "summary.trigram",
          "suggest_mode" : "always",
          "min_word_length" : 1
        } ],
        "collate": {
          "query": { 
            "source" : {
              "match": {
                "{{field_name}}" : "{{suggestion}}" 
              }
            }
          },
          "params": {"field_name" : "summary"}, 
          "prune": true 
        }
      }
    }
  }
}

```

Below is the Result of the Query \>\>

```
{
  "took": 7,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 0,
    "max_score": 0,
    "hits": []
  },
  "suggest": {
    "simple_phrase": [
      {
        "text": "Jave programing",
        "offset": 0,
        "length": 15,
        "options": [
          {
            "text": "Java programming",
            "score": 0.040497053,
            "collate_match": true
          },
          {
            "text": "Jave programming",
            "score": 0.00245566,
            "collate_match": true
          },
          {
            "text": "Java programing",
            "score": 0.0019024129,
            "collate_match": true
          }
        ]
      }
    ]
  }
}

```

When We See the Query Result We See 3 results **Java programming , Jave programming & Java programing**... How Can We Rectify the Query to provide me result only and only if all the Words are correct and not Provide results like \*\* Jave programming & Java programing\*\* where any one of the Words are Correct...

Pls Guide..

---

<div class="post-metadata">

**Author:** ![Akshay\_Deep\_Lamba](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Akshay\_Deep\_Lamba](https://discuss.elastic.co/u/Akshay_Deep_Lamba)\
**Post date:** [December 13, 2017, 8:25am UTC](https://discuss.elastic.co/t/issue-with-suggester/110400/2 "2017-12-13T08:25:58Z")

</div>

Pls guide..

---

<div class="post-metadata">

**Author:** ![Tom\_Mortimer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tom_mortimer/32/21049_2.png) [@Tom\_Mortimer](https://discuss.elastic.co/u/Tom_Mortimer)\
**Post date:** [December 13, 2017, 10:28am UTC](https://discuss.elastic.co/t/issue-with-suggester/110400/3 "2017-12-13T10:28:12Z")

</div>

Have you tried experimenting with the `confidence`, `max_errors` and `suggest_mode` parameters, as outlined here? [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)

---

<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:** [January 10, 2018, 10:28am UTC](https://discuss.elastic.co/t/issue-with-suggester/110400/4 "2018-01-10T10:28:31Z")

</div>

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