feat: add support for range field types in Discover - #12430
feat: add support for range field types in Discover#12430mmustafasenoglu wants to merge 3 commits into
Conversation
Add support for OpenSearch range field types (integer_range, float_range, long_range, double_range, date_range, ip_range) in Discover. These types were missing since OpenSearch was forked from Elasticsearch 7.12, causing range fields to display as unknown. Range fields are modeled with distinct OSD field types (NUMBER_RANGE, DATE_RANGE, IP_RANGE) instead of mapping to scalar types, preventing unintended sort/filter behaviors. Changes: - types.ts: Added NUMBER_RANGE, DATE_RANGE, IP_RANGE to OSD_FIELD_TYPES and INTEGER_RANGE, FLOAT_RANGE, LONG_RANGE, DOUBLE_RANGE, DATE_RANGE, IP_RANGE to OPENSEARCH_FIELD_TYPES - osd_field_types_factory.ts: Added 3 new OsdFieldType entries - osd_field_types.test.ts: Updated tests for new range types - field_editor.test.tsx.snap: Updated snapshot for range field types Closes opensearch-project#11053 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Mustafa Senoglu <18672489+mmustafasenoglu@users.noreply.github.com>
PR Reviewer Guide 🔍(Review updated until commit 604d209)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 76e942e Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 9080f88
Suggestions up to commit 29be468
Suggestions up to commit 7eba96f
|
7eba96f to
29be468
Compare
|
Persistent review updated to latest commit 29be468 |
29be468 to
9080f88
Compare
|
Persistent review updated to latest commit 9080f88 |
❌ 3 Jest Test Failure(s)📄
|
|
Persistent review updated to latest commit 76e942e |
…management snapshot
|
Persistent review updated to latest commit 604d209 |
|
does it support natively in discover? do we need other changes for building DSL queries |
|
Hi @Hailong-am, yes — the range field types are displayed natively in Discover after this change. Range fields (, , , , , ) are mapped to distinct OSD field types (, , ) with the appropriate filterable/aggregatable flags and range bar visualization. For DSL queries: OpenSearch's query DSL already supports range fields natively (e.g. |
sounds good. Can you fix DCO as well? |
Description
Add support for OpenSearch range field types (
integer_range,float_range,long_range,double_range,date_range,ip_range) in Discover. These types were missing since OpenSearch was forked from Elasticsearch 7.12, causing range fields to display asunknown.Approach
Range fields are interval/object values (
{gte, lte}), not scalar values. Instead of mapping them to scalar OSD types, range fields are modeled with distinct OSD field types:integer_range,float_range,long_range,double_rangeNUMBER_RANGEdate_rangeDATE_RANGEip_rangeIP_RANGEThese types default to
sortable: false, filterable: false, preventing invalid sort/filter/aggregation operations.Changes
NUMBER_RANGE,DATE_RANGE,IP_RANGEtoOSD_FIELD_TYPESenum + range OpenSearch typesOsdFieldTypeentries with range-specific esTypes mappingsRelated issue
Closes #11053
Note
Previous PR #12393 was closed due to test snapshot failures and missing DCO sign-off. This is a single squashed commit with all fixes applied and DCO signed.