Possible bug in completion context suggester (6.8 and 7.10)

Hi, I've come across some strange behavior using the completion suggest. In my scenario it seems that inputs over ~34 characters are ignored. I have steps to reproduce.

Create this index, post this doc then try the query, then edit and re-index the doc with a slightly shorter nameSuggest.input (take 1 char off the end), and try again. I have tried with 6.8 and 7.10, same result. I have set the max_input_length to 500, which unsurprisingly didn't help since the issue is occurring before the default of 50.

PUT suggest-test
{
  "settings": {
    "index": {
      "mapping": {
        "ignore_malformed": "true"
      },
      "refresh_interval": "1s",
      "number_of_shards": "4",
      "sort": {
        "field": "suggestType"
      },
      "analysis": {
        "filter": {
          "ngram_filter": {
            "type": "edge_ngram",
            "min_gram": "1",
            "max_gram": "24"
          }
        },
        "analyzer": {
          "whitespace_analyzer": {
            "type": "custom",
            "tokenizer": "lowercase"
          },
          "ngram_analyzer": {
            "filter": [
              "ngram_filter",
              "lowercase"
            ],
            "type": "custom",
            "tokenizer": "lowercase"
          }
        }
      },
      "number_of_replicas": "1"
    }
  },
  "mappings": {
    "properties": {
      "createdDate": {
        "type": "date"
      },
      "healthSystemId": {
        "type": "keyword"
      },
      "id": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "imageUrl": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "inputNgram": {
        "type": "text",
        "analyzer": "ngram_analyzer",
        "search_analyzer": "whitespace_analyzer"
      },
      "inputValue": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "modifiedDate": {
        "type": "date"
      },
      "nameSuggest": {
        "type": "completion",
        "analyzer": "ngram_analyzer",
        "search_analyzer": "whitespace_analyzer",
        "preserve_separators": true,
        "preserve_position_increments": false,
        "max_input_length": 500,
        "contexts": [
          {
            "name": "HealthSystemId",
            "type": "CATEGORY",
            "path": "healthSystemId"
          },
          {
            "name": "SuggestType",
            "type": "CATEGORY",
            "path": "suggestType"
          },
          {
            "name": "SuggestSubType",
            "type": "CATEGORY",
            "path": "suggestSubType"
          }
        ]
      },
      "objectType": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "relatedCount": {
        "type": "long"
      },
      "searchAttributeName": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "sourceReference": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "sourceReferenceExternal": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "sourceReferenceSecondary": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "subType": {
        "type": "keyword"
      },
      "suggest": {
        "type": "completion",
        "analyzer": "whitespace_analyzer",
        "preserve_separators": true,
        "preserve_position_increments": false,
        "max_input_length": 500,
        "contexts": [
          {
            "name": "HealthSystemId",
            "type": "CATEGORY",
            "path": "healthSystemId"
          },
          {
            "name": "SuggestType",
            "type": "CATEGORY",
            "path": "suggestType"
          },
          {
            "name": "SuggestSubType",
            "type": "CATEGORY",
            "path": "suggestSubType"
          }
        ]
      },
      "suggestSubType": {
        "type": "keyword"
      },
      "suggestType": {
        "type": "keyword"
      },
      "suggestedValue": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "type": {
        "type": "keyword"
      }
    }
  }
}
PUT /suggest-test/_doc/PDS215725
{
    "healthSystemId" : 197,
    "id" : "PDS215725",
    "type" : "Specialty",
    "subType" : [  ],
    "suggestType" : "197-Specialty",
    "suggestSubType" : [ "5c478f3a47d751d586b66baf1ea952a51"],
    "inputValue" : "Vascular and Interventional Radiology",
    "nameSuggest" : {
      "input" : [ "Vascular and Interventional Radiology Te" ]
    },
    "suggestedValue" : "Marketing Published Specialty:Vascular and Interventional Radiology",
    "searchAttributeName" : "specialtyDomains.specialties.specialtyFullName",
    "sourceReference" : "215724",
    "sourceReferenceSecondary" : "",
    "createdDate" : "2021-06-11T05:09:18",
    "modifiedDate" : "2021-06-11T05:09:18",
    "objectType" : "provider",
    "relatedCount" : 0
  }    
POST /suggest-test/_search
 {
        "size": 100,
        "suggest": {
            "specialty": {
                "completion": {
                    "contexts": {
                        "SuggestSubType": [
                            {
                                "context": "5c478f3a47d751d586b66baf1ea952a51"
                            }
                        ]
                    },
                    "field": "nameSuggest",
                    "size": 100
                },
                "prefix": "vascular"
            }
        }
    }

no result...

PUT /suggest-test/_doc/PDS215725
{
    "healthSystemId" : 197,
    "id" : "PDS215725",
    "type" : "Specialty",
    "subType" : [  ],
    "suggestType" : "197-Specialty",
    "suggestSubType" : [ "5c478f3a47d751d586b66baf1ea952a51"],
    "inputValue" : "Vascular and Interventional Radiology",
    "nameSuggest" : {
      "input" : [ "Vascular and Interventional Radiology T" ]
    },
    "suggestedValue" : "Marketing Published Specialty:Vascular and Interventional Radiology",
    "searchAttributeName" : "specialtyDomains.specialties.specialtyFullName",
    "sourceReference" : "215724",
    "sourceReferenceSecondary" : "",
    "createdDate" : "2021-06-11T05:09:18",
    "modifiedDate" : "2021-06-11T05:09:18",
    "objectType" : "provider",
    "relatedCount" : 0
  }    
POST /suggest-test/_search
 {
        "size": 100,
        "suggest": {
            "specialty": {
                "completion": {
                    "contexts": {
                        "SuggestSubType": [
                            {
                                "context": "5c478f3a47d751d586b66baf1ea952a51"
                            }
                        ]
                    },
                    "field": "nameSuggest",
                    "size": 100
                },
                "prefix": "vascular"
            }
        }
    }

1 result!

What is going on here?

Thanks,
Brian

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