Skip to content

[Feature Request] Add field-leval meta to all types #20599

@urmichm

Description

@urmichm

Is your feature request related to a problem? Please describe

Not all fields field types allow meta data, for example:

  "mappings": {
    "properties": {
      "my_flat_object": {
        "type": "flat_object",
        "meta": {  // meta is not supported
          "this": "is not allowd"
        }
      },
      "my_text": {
        "type": "text",
        "meta": { // meta is supported
          "this": "is allowed"
        }
      }

    },

This is inconsistent and might confuse the user.
The issue discovered during #19884

Describe the solution you'd like

Extract parsing of the meta block to Base Mapper/Parser class and make parseMeta method final to ensure the consistency across all field types.
Such approach will enforce:

  • the meta block to be exclusively field related (independent of the type)
  • the meta block is identified exactly the same across all the fields
  • Validated of the meta block is the same
  • reduces the usage of Magic values for string (no repeated "meta" String)

We may introduce simple OpenSearchNames class with all necessary String names:
example:

// OpenSearchNames.java
public class OpenSearchNames {
  private OpenSearchNames(){} // no constructors

 public static final String META = "meta"; 
 public static final String ID = "_id";
 public static final String DOC = "_doc";
// ....
}

The util class may grow slowly eradicating the Magic values in the code

Related component

No response

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    IndexingIndexing, Bulk Indexing and anything related to indexingdiscussIssues intended to help drive brainstorming and decision makingenhancementEnhancement or improvement to existing feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions