Phrase Suggester Returns Suggestions from Deleted Documents as of 7.0.0

Issue

As of Elasticsearch 7.0.0, the Phrase Suggester returns suggestions of deleted documents.

I assume this is a bug. However, the documentation on Suggesters | Elasticsearch Reference [7.11] | Elastic does not state how deleted documents are handled by suggesters in general. The documentation of the Completion Suggester specifically mentions that it does not return results of deleted documents, but it is unclear if this implies that the other suggesters do make use of deleted documents.

Scenario

  • Given an index with a text property
  • When document 1 with property "coarse" is indexed
  • And all documents are deleted
  • And document 2 with property "course" is indexed
  • And phrase suggestions for value "corse" are requested
  • Then only the suggestion "course" (from document 2) should be returned

Here are the Kibana dev tools requests:

PUT test_index
{
  "mappings": {
    "properties": {
      "some_field": {
        "type": "text"
      }
    }
  }
}

PUT test_index/_doc/1
{"some_field":"Coarse"}

POST /test_index/_delete_by_query
{"query":{"match_all":{}}}

PUT test_index/_doc/2
{"some_field":"Course"}

GET /test_index/_search
{
  "size": 0,
  "suggest": {
    "suggestions": {
      "text": "corse",
      "phrase": {
        "field": "some_field"
      }
    }
  }
}

Results

In version 6.8.14 this scenario behaves as I expected. As of 7.0.0 this scenario fails because 2 suggestions are returned: "coarse" and "course". I do not expect "coarse" from document 1 to be returned as a suggestion because that document was deleted.

I did not find anything in the release notes or breaking changes of Elasticsearch 7.0.0 which could relate to this change of behavior, so I assume that this is a bug.

Could I please get feedback on this from an Elasticsearch developer? Can you confirm that this is a bug, so that I can post a bug report on the Elasticsearch Github?