Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Support mapping for object type and new settings for derived fields #13715

Open
rishabhmaurya opened this issue May 16, 2024 · 0 comments · May be fixed by #13717 or #13720
Open

[Feature Request] Support mapping for object type and new settings for derived fields #13715

rishabhmaurya opened this issue May 16, 2024 · 0 comments · May be fixed by #13717 or #13720
Assignees
Labels
enhancement Enhancement or improvement to existing feature or request Search:Query Capabilities

Comments

@rishabhmaurya
Copy link
Contributor

Is your feature request related to a problem? Please describe

Support mappings object type as described in #13143
Introduce following new settings applicable both to object and other types of derived fields -

"properties": {
   <field>: <type>
},
"source_indexed_field": <field_name>
"format": <date-format>
"ignore_malformed": <boolean>

source_indexed_field: This indexed field should be of type text and will be used to filter documents in 2 phased iterator approach before executing the expensive DerivedFieldQuery fetching from source, running script, deriving value, creating memory index. This is to improve the performance for object type.
properties: fieldname and field type can be specified explicity to avoid inferring the type of sub fields within object type.
format: date format to be used when type is inferred. Unrelated to object type and applicable to all types.
ignore_malformed: ignores malformed documents for cases when field value cannot be derived or there is a type mismatch. If set to true, the query will ignore such documents and proceeds with rest of the matching documents.

{
  "mappings": {
    "properties": {
      "specs_json": { "type": "text" }
    },
    "derived": {
      "derived_specs": {
        "type": "object",
        "script": "emit(params._source[\"specs_json\"])",
        "format": "dd-MM-yyyy",
        "ignore_malformed": true,
        "properties": {
                "details.edition": "keyword",
                "details.pages": "long"
        },
        "source_indexed_field": "specs_json"
      }
    }
  }
}

Describe the solution you'd like

Support mapping with following definition for derived fields -

{
  "mappings": {
    "properties": {
      "specs_json": { "type": "text" }
    },
    "derived": {
      "derived_specs": {
        "type": "object",
        "script": "emit(params._source[\"specs_json\"])",
        "format": "dd-MM-yyyy",
        "ignore_malformed": true,
        "properties": {
                "details.edition": "keyword",
                "details.pages": "long"
        },
        "source_indexed_field": "specs_json"
      }
    }
  }
}

Related component

Search:Query Capabilities

Describe alternatives you've considered

No response

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or improvement to existing feature or request Search:Query Capabilities
Projects
Status: 🆕 New
2 participants