opensearch-project/OpenSearch

[Feature Request] Analyzers on non-text sub fields

Open

#11,882 建立於 2024年1月15日

在 GitHub 查看
 (3 留言) (0 反應) (0 負責人)Java (1,505 fork)batch import
Indexingenhancementhelp wanted

倉庫指標

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

描述

Is your feature request related to a problem? Please describe

In my domain, Every single type of document has an id that consists of two parts: id space and thei d itself, e.g. 31-111. When trying to sort by id, I'd actually want to sort by the last part, numerically. Currently I cannot create an analyzer for a sub field (ie.g. d.number) that would index the id part as a long because analyzers work on strings.

Describe the solution you'd like

When the main field is a string (text, keyword) and the sub field is another type, you should be able to set an analyzer to the sub field. Opensearch should try to cast the result to the type of the sub field.

Related component

Indexing

Describe alternatives you've considered

Store the number part in a separate field.

  • It's not part of the data so the result is awkward.
  • The purpose of sub fields is to avoid this exact thing.

Script sorting

  • Performance becomes an issue.

Additional context

No response

貢獻者指南