[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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인