opensearch-project/OpenSearch

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

Open

#1,901 opened on 2022年1月14日

GitHub で見る
 (12 comments) (3 reactions) (1 assignee)Java (1,505 forks)batch import
Search:Relevancebuggood first issuehacktoberfest

Repository metrics

Stars
 (8,123 stars)
PR merge metrics
 (平均マージ 5d 9h) (30d で 266 merged PRs)

説明

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)

コントリビューターガイド