opensearch-project / opensearch-project/OpenSearch

[RFC] Unmap the fields which would make the mapping exceeds the total fields limit or depth limit

Open
#14,031 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Indexing
Dominant language
Java
Stars
13.7k
Forks
3k
Avg merge
2d 23h
Merged PRs (30d)
108

Description

Is your feature request related to a problem? Please describe

This idea originates from https://github.com/opensearch-project/OpenSearch/issues/13089.

In log analytics scenario, it's common to see so many mapped fields in an index, dynamic mapping is commonly used to make new detected fields being added to the mapping automatically, but in order to avoid mapping explosion, we have some index level mapping limit, such as index.mapping.total_fields.limit which defaults to 1000, and index.mapping.depth.limit which defaults to 20.

However, when the mapping limit breaches, all of the following indexing requests containing new detected fields will fail with an error Limit of total fields [1000] has been exceeded, a temporary solution about this problem is to increase the limit manually, but once the new limit breaches, users have to increase the limit again, that is not practical.

Describe the solution you'd like

We can give users an option to let them control the behavior when the mapping exceeds the limit, one option is that we do not index the new detected fields, just like set dynamic: false to the index mapping, new detected fields are not added to the mapping, and also not indexed, not searchable but still be stored in _source, so that the indexing request won't fail, and users can still see the unmapped fields in the document.

Because the mapping limit are index level, I think we can also add some index level settings to control the behavior when the limit breaches, something like this:

PUT test-index
{
  "settings": {
    "index.mapping.total_fields.limit":1000,
    "index.mapping.total_fields.unmap_fields_beyond_limit":true,
    "index.mapping.depth.limit":20,
    "index.mapping.depth.unmap_fields_beyond_limit":true
  }
}
Related component

Indexing

Describe alternatives you've considered

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the related issue #13089 and the Indexing component context, then investigate how index-level total-fields and depth-limit settings are represented. Done means users can opt to leave fields beyond either limit unmapped while retaining them in _source, without indexing failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.