opensearch-project/OpenSearch

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

Open

#1,901 建立於 2022年1月14日

在 GitHub 查看
 (12 留言) (3 反應) (1 負責人)Java (1,505 fork)batch import
Search:Relevancebuggood first issuehacktoberfest

倉庫指標

Star
 (8,123 star)
PR 合併指標
 (平均合併 5天 9小時) (30 天內合併 266 個 PR)

描述

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)

貢獻者指南