Inconsistent behaviour of Fuzziness for Completion Suggester

Hello,

Please see the below (ES Version : 6.2.3):

  1. Mapping:
 PUT /demo_suggestions
{
  "settings": {
    "analysis": {
      "analyzer": {
        "custom_analyzer_with_edge_ngram_filter": {
          "tokenizer": "standard",
          "char_filter": [
            "html_strip"
          ],
          "filter": [
            "lowercase",
            "asciifolding",
            "trim",
            "classic",
            "unique",
            "custom_edge_ngram_filter"
          ]
        }
      },
      "filter": {
        "custom_edge_ngram_filter": {
          "type": "edge_ngram",
          "min_gram": 1,
          "max_gram": 10
        }
      }
    }
  },
  "mappings": {
    "_doc": {
      "properties": {
        "suggest": {
          "type": "completion"
        },
        "query_string": {
          "type": "keyword",
          "fields": {
            "edge_ngram_filter": {
              "type": "text",
              "analyzer": "custom_analyzer_with_edge_ngram_filter",
              "search_analyzer": "standard"
            }
          }
        }
      }
    }
  }
}   
  1. Data
    PUT /demo_suggestions/_doc/1?refresh
            {
                "suggest" : {
                    "input": [ "crime" ]
                },
                "query_string": "crime"
            }
  1. Query

     GET demo_suggestions/_search
     {
         "query": {
             "match" : {
                 "query_string.edge_ngram_filter" : {
                     "query" : "crik",
                     "fuzziness": "AUTO:5,8",
                     "prefix_length": 3
                     
                 }
             }
         },
         "suggest": {
             "afdskjlda-suggest" : {
                 "prefix" : "crik",
                 "completion" : {
                     "field" : "suggest",
                     "fuzzy" : {
                         "fuzziness" : "AUTO:5,8",
                         "prefix_length": 3
                     }
                 }
             }
         }
         
     }
    
  2. Response

     {
       "took": 0,
       "timed_out": false,
       "_shards": {
         "total": 5,
         "successful": 5,
         "skipped": 0,
         "failed": 0
       },
       "hits": {
         "total": 0,
         "max_score": null,
         "hits": []
       },
       "suggest": {
         "afdskjlda-suggest": [
           {
             "text": "crik",
             "offset": 0,
             "length": 4,
             "options": [
               {
                 "text": "crime",
                 "_index": "demo_suggestions",
                 "_type": "_doc",
                 "_id": "1",
                 "_score": 3,
                 "_source": {
                   "suggest": {
                     "input": [
                       "crime"
                     ]
                   },
                   "query_string": "crime"
                 }
               }
             ]
           }
         ]
       }
     }
    

Why is it that the hits is empty and the suggest has a result? IMHO, since fuzziness is defined as "AUTO:5,8" it should not look for fuzzy results on query strings of length less than 5 chars. Both, hits and suggest section should be empty. The problem disappears when the "min_length" is increased to 6 for suggest query. Please advise.

I have not been able to understand this behaviour. Any help will be appreciated.

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