Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to create Elasticsearch Index template index templates

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to create Elasticsearch index template index templates". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to create Elasticsearch index template index templates.

I.

Index template, define template, automatically match when a new index is created, and apply the defined template

New Index template (index templates)

Let's create a new index template template_1 to set its main shard to 1. Type has type1 and _ source disabled

PUT / _ template/template_1 {"template": "tmuri *", "settings": {"number_of_shards": 1} "mappings": {"type1": {"_ source": {"enabled": false} POST / t-1GET / t-1/_mapping {"tmur1": {"mappings": {"type1": {"_ source": {"enabled": false} "properties": {}

Example: when we want to create an index again, we also create an alias for it

PUT / _ template/template_2 {"template": "smurf *", "settings": {"number_of_shards": 1}, "aliases": {"alias1": {}, "{index}-alias": {}} POST / s-1GET / smur1

When multiple index templates are created, and an index is created and matched by multiple index templates, then settings and mappings will be merged into a configuration and applied to the index, the order of which is controlled by the order property of the index template. Large order will overwrite the previous configuration

PUT / _ template/template_1 {"template": "*", "order": 0, "settings": {"number_of_shards": 1}, "mappings": {"type1": {"_ source": {"enabled": false} PUT / _ template/template_2 {"template": "tt-*" "order": 1, "settings": {"number_of_shards": 1}, "mappings": {"type1": {"_ source": {"enabled": true} POST / tt-1 = > will be matched by both templates mentioned above For the _ source attribute order=1, order=0 or enabled:true will be overridden.

File configuration: we can add json configuration files under the config/templates directory

Thank you for reading, the above is the content of "how to create Elasticsearch index template index templates". After the study of this article, I believe you have a deeper understanding of how to create Elasticsearch index template index templates, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report