-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 for object type in Derived Fields #13143
Comments
we decided in search community meeting to use |
@msfroh @reta {
"mappings": {
"properties": {
"product_name": { "type": "keyword" },
"product_json": { "type": "text", "index": false }
},
"derived": {
"derived_product_json": {
"type": "object",
"script": {
"source": "emit(params._source[\"product_json\"])"
}
"properties": {
"default": "keyword", // inferring logic will use default type if specified instead of inferring the type
"derived_product_json.brand": "keyword",
"derived_product_json.price": "long"
}
}
}
}
} |
@rishabhmaurya I think it should follow the same pattern as mappings:
I think the
should not be there but the same logic as applied to dynamic mappings could be used. That would bring consistent behaviour to all variations of mapping. |
that makes sense, thanks @reta |
Is your feature request related to a problem? Please describe
Issue: #12281
With the current implementation of derived fields in OpenSearch, we support various primitive types such as keyword, long, double, geo_point, ip, date, and boolean. However, there are scenarios where users may need to derive fields of type object based on source fields containing JSON data. This proposal aims to enhance derived fields to support nested JSON structures, enabling users to query subfields within derived JSON fields.
Current Scenario
Consider the following index mapping definition:
In this example, product_json contains a JSON object, and derived_product_json derives a field of type keyword representing the entire JSON object. However, querying specific subfields within derived_product_json is currently not possible since subfields are not defined within the derived field context.
Describe the solution you'd like
Introduce a new field type called json or object within the derived fields context to support nested JSON structures. This enhancement will enable users to query subfields of derived JSON fields, providing greater flexibility in data querying and analysis.
Proposed Mapping
Example Document
Consider a document with the following structure:
Querying Subfields
With the proposed enhancement, users can query subfields within derived_product_json. For instance:
This query retrieves documents where the derived product_json field contains specific brand and model values.
Related component
Search:Performance
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: