Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to prevent Mapping explosion in ElasticSearch

Shulou Source: shulou.com Published: 2022-06-02 06:28:22 09月30日 Update

How to prevent Mapping explosion in ElasticSearch? for this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

1 background of the story

One day, my colleague told me that ES data cannot be inserted. Query cluster logs.

Requests java.lang.IllegalArgumentException: Limit of total fields [1000] in index [my_index] has been exceeded

2 Mapping description

Mapping is protected by mapping to prevent mapping explosion

The following settings allow you to limit the number of field mappings that can be created manually or dynamically to prevent incorrect documents from causing mapping explosions:

Index.mapping.total_fields.limit:

The maximum number of fields in the index. Default value is 1000

Index.mapping.depth.limit:

The maximum depth of the field, measured by the number of internal objects. For example, if all fields are defined at the root object level, the depth is 1. If there is an object mapping, the depth is 2, and so on. The default value is 20.

Index.mapping.nested_fields.limit

The maximum number of fields in the nested index, default is 50. Index 1 document with 100 nested fields actually index 101 documents, because each nested document is indexed as a separate hidden document

3 temporary solution Modification settingPUT my_index/_settings {"index.mapping.total_fields.limit": 2000} the answer to the question on how to prevent Mapping explosion in ElasticSearch is shared here. I hope the above content can be of some help to everyone. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

Tags: Fields documents indexes explosions maximum objects depth questions numbers more help answers easy easy content dynamic colleagues actually guys Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Tech Info MySQL Shulou Technology Redmi