opensearch-project/OpenSearch

[BUG] `term_vector` does not work on `search_as_you_type` fields

Open

#1.901 geöffnet am 14. Jan. 2022

Auf GitHub ansehen
 (12 Kommentare) (3 Reaktionen) (1 zugewiesene Person)Java (1.505 Forks)batch import
Search:Relevancebuggood first issuehacktoberfest

Repository-Metriken

Stars
 (8.123 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 5T 9h) (266 gemergte PRs in 30 T)

Beschreibung

Describe the bug TL;DR: same issue reported here.

Per ElasticSearch's 7.10 documentation (which AFAICT should be compatible with OpenSearch 1.x), setting term_vector on a search_as_you_type field should only affect the shingle subfields, but not the index prefix subfield. However, when attempting to index documents with this mapping, an illegal_argument_exception is thrown.

To Reproduce Steps to reproduce the behavior:

  1. Create a new index with the following mapping:
{
  // ...
  "my_field":
    "type": "search_as_you_type",
    "term_vector": "with_positions_offsets"
  // ...
}
  1. Attempt to index a document containing a my_field field
  2. Observe the following error:
{
  "type": "illegal_argument_exception",
  "reason": "cannot index term vector offsets when term vectors are not indexed (field=\"my_field._index_prefix\")"
}

Expected behavior Documents should be indexed without issue. Only the ._2gram and ._3gram shingle subfields should have the term_vector set, and not the ._index_prefix n-gram subfield.

Plugins N/A

Screenshots N/A

Host/Environment

  • Version: 1.2.3 (opensearchproject/opensearch:latest)

Contributor Guide