[OpenSearch] Static Mapping Question

1

Hi, We are planning to create a static mapping template in OpenSearch. Just want to know few things:

  1. Will the static mapping help us on query performance? (such as reduce searching latency)
  2. Will the static mapping help us on reduce resource usage? (CPU, RAM, ...)
  3. Since our upstream add new attributes in the incoming records over time, so we will keep the mappings -> dynamic to true in our _index_template, and only add part of all incoming attributes in the mapping template. In this case, will static mapping help in terms of performance?

Thanks, Frank

Frank
已提问 3 个月前435 查看次数
1 回答
2
已接受的回答

Hello Frank,

Regarding to your questions :-

  1. Will the static mapping help us on query performance? (such as reduce searching latency)

Yes, defining static mappings can improve query performance. By specifying the data types Prior specification of data types and index configurations helps OpenSearch to remove load of determination the data type and help in query performance and help reduce indexing latency.

  1. Will the static mapping help us on reduce resource usage? (CPU, RAM, ...)

Yes, again as per 1 it will decrease the query time which help decreasing the CPU but not to a great extent. However, the indexing and searching overhead savings are usually marginal.

  1. Since our upstream add new attributes in the incoming records over time, so we will keep the mappings -> dynamic to true in our _index_template, and only add part of all incoming attributes in the mapping template. In this case, will static mapping help in terms of performance?

If you are keeping mappings dynamic to true to accommodate new fields being added, some of the performance benefits of static mappings are reduced. However, for the fields defined statically upfront, you will still see faster indexing and better query execution. This is because data types and index parameters are pre-configured for those known fields.

REF :- [+] https://opensearch.org/docs/latest/field-types/#explicit-mapping [+] Troubleshoot search latency spikes -- https://repost.aws/knowledge-center/opensearch-latency-spikes [+] https://opensearch.org/docs/1.3/api-reference/index-apis/create-index/#static-index-settings

So in summary - even with dynamic mappings enabled, having some portion of expected fields defined in a static template is beneficial. It saves resources for those known fields. Just ensure the static and dynamic mapped fields don't conflict in data types defined. The static mappings boost performance, but dynamic mappings provide flexibility.

Feel free to reply if you need any further information.

Thank you!

AWS
支持工程师
已回答 3 个月前
profile picture
专家
已审核 2 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则