Completion suggester returning less number of results

Elasticsearch version: 5.4.3

JVM version: 1.8

OS version: ubuntu 14.04

I created an index with the following mapping.

          "areadocument": {
             "properties": {
                "areaSuggests": {
                   "type": "completion",
                   "analyzer": "standard",
                   "preserve_separators": false,
                   "preserve_position_increments": true,
                   "max_input_length": 50,
                   "contexts": [
                      {
                         "name": "category",
                         "type": "CATEGORY",
                         "path": "areaSuggests.contexts.category"
                      }
                   ]
                },
                "id": {
                   "type": "keyword"
                },
                "output": {
                   "type": "keyword"
                }

The problem is that the suggest query is returning less number of results.

When I query for a size of 5 documents, it returns 2 documents for a prefix.
When I run the same query with a asking size of 10, it returns 3 documents.

The following is the query:

 {
    "suggest": {
       "suggestions": {
          "prefix": "and",
          "completion": {
             "field": "areaSuggests",
             "size": 5,
             "contexts": {
                "category": ["1"]
             }
          }
       }
    }
 }

Shouldn't the query with a size of 5 also return 3 results. Am I missing something?

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