Skip to content

Phrase suggester throws ArrayIndexOutOfBoundsException when stopwords are the only text values #2817

@tteats

Description

@tteats

-Version 0.90.0.RC1
When searching for phrase suggestions and all suggestions are stop words, then I would expect empty results instead of an ArrayIndexOutOfBoundsException.

curl -XPUT http://localhost:9200/test -d '{ "number_of_shards":1, "number_of_replicas":0 }'
curl -XPUT http://localhost:9200/test/test/1 -d '{ "subject": "a test subject" }'
curl -XPOST http://localhost:9200/test/_suggest?pretty=true -d '{
  "text": "a an the",
  "sug2": {
    "phrase": {
      "field": "subject",
      "size": 1,
      "real_word_error_likelihood": 0.95,
      "max_errors": 0.5,
      "gram_size": 2,
      "direct_generator": [
        {
          "field": "subject",
          "suggest_mode": "always",
          "min_word_len": 1
        }
      ]
    }
  }
}'

# Response
{
  "_shards" : {
    "total" : 1,
    "successful" : 0,
    "failed" : 1,
    "failures" : [ {
      "index" : "test",
      "shard" : 0,
      "reason" : "BroadcastShardOperationFailedException[[test][0] ]; nested: ElasticSearchException[failed to execute suggest]; nested: ArrayIndexOutOfBoundsException[0]; "
    } ]
  }
}

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions