Skip to content

[ES|QL] Index editor - Allow selecting column type#241637

Merged
sddonne merged 67 commits intoelastic:mainfrom
sddonne:index-editor-column-mappings
Nov 27, 2025
Merged

[ES|QL] Index editor - Allow selecting column type#241637
sddonne merged 67 commits intoelastic:mainfrom
sddonne:index-editor-column-mappings

Conversation

@sddonne
Copy link
Contributor

@sddonne sddonne commented Nov 3, 2025

Closes #240784

Summary

Now it's possible to select the column type in the Lookup Index Editor, instead of relying in ES dynamic mapping.

column-types

Known Limitations

Field types that are not supported by ES|QL are allowed to be selected, and values can be pushed to the index, but are not going to be visible neither in Discover or if the flyout is reopened.

image

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

});

it('should display placeholder when no type is selected', () => {
render(<FieldSelect selectedType={null} onTypeChange={mockOnTypeChange} />);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just in case it works better for you too, not a mandatory or anything more of a how i usually do tests - i usually like to have a set up method that does the rendering and creates the defaults, in this case it'd remove the need for the beforeEach and for the onTypeChange setting every time, something like:

const setup = (props: Partial<React.ComponentProps<typeof FieldSelect>> = {}) => {
  const mockOnTypeChange = jest.fn()
  const user = userEvent.setup()

  render(<FieldSelect selectedType={null} onTypeChange={mockOnTypeChange} {...props} />)

  return { mockOnTypeChange, user }
}

describe('FieldSelect', () => {
  ...
  it('should call onTypeChange with null when selection is cleared', async () => {
    const { user, mockOnTypeChange } = setup()

    const clearButton = screen.getByTestId('comboBoxClearButton');
    await user.click(clearButton);

    expect(mockOnTypeChange).toHaveBeenCalledWith(null);
  });
  ...
}
Copy link
Contributor

@AlexGPlay AlexGPlay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code review only LGTM but not sure if anyone with more context wants to double check this

@kertal kertal requested a review from a team November 25, 2025 06:44
Copy link
Contributor

@jughosta jughosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition to the flow!

Comment on lines +46 to +57
{
label: i18n.translate('fieldUtils.fieldTypeSelect.group.booleanDate', {
defaultMessage: 'Boolean & Date',
}),
types: ['boolean', 'date', 'date_nanos'],
},
{
label: i18n.translate('fieldUtils.fieldTypeSelect.group.ipGeo', {
defaultMessage: 'IP & Geo',
}),
types: ['ip', 'geo_point', 'geo_shape'],
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This grouping is a bit confusing. Can we have them separately?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or it could be 3 groups: Common (with boolean, binary), Dates and Geo.
And additionally Structured (with ip, version). It would be closer to docs categories

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm you are right @jughosta, the groups can do better.

What do you think of this distribution? (I'm not using Common as I think it's not the best for grouping boolean and binary, if we use Common maybe it should contain all the most used types.)

@l-suarez whats your opinion on the groups?

Text

  'text',
  'keyword',
  'constant_keyword',
  'wildcard',
  'match_only_text',
  'search_as_you_type',
  'semantic_text',

Numeric

  'byte',
  'double',
  'float',
  'half_float',
  'integer',
  'long',
  'short',
  'unsigned_long',
  'histogram',

Dates

  'date', 
  'date_nanos'

Boolean & Binary

   'boolean', 
   'binary'

Geo

   'geo_point', 
   'geo_shape'

Object

    'flattened'

Structured

   'ip',
  'version',
  'integer_range',
  'float_range',
  'long_range',
  'ip_range',
  'double_range',
  'date_range',

Advanced

   'rank_feature', 
    'rank_features', 
    'dense_vector', 
    'sparse_vector', 
    'percolator'
Screen.Recording.2025-11-25.at.15.03.23.mov
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the groups are good as they are. We should not add "Common". We reference to the documentation from the current field type filter on DSL and here we also don't have "Common". The groups seems fine for me.

},
{
label: i18n.translate('fieldUtils.fieldTypeSelect.group.structured', {
defaultMessage: 'Structured',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to our docs it would be Object.

Suggested change
defaultMessage: 'Structured',
defaultMessage: 'Object',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data-test-subj="indexEditorColumnNameInput"
value={columnName}
placeholder={i18n.translate('indexEditor.columnHeaderEdit.columnNamePlaceholder', {
defaultMessage: 'Choose the name of the field',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option:

Suggested change
defaultMessage: 'Choose the name of the field',
defaultMessage: 'Enter field name',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless you've a strong position in this one I would like to stick with the design proposal https://www.figma.com/design/QltbaeErcZzbVbSqwpccvG/Lookup-UX?node-id=2003-74648&p=f&t=qS2l8kBpKAF2pM8c-0 🙏

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just looked at the designs - We should go with @jughosta's proposal if possible 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, thank you both! 9aa9600

defaultMessage: 'Select a field type',
})}
helpText={i18n.translate('indexEditor.columnHeaderEdit.fieldTypeHelpText', {
defaultMessage: `You won't be able to change the type after saving it.`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
defaultMessage: `You won't be able to change the type after saving it.`,
defaultMessage: `You won't be able to change the type after saving the lookup index.`,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated! 98214fd

<EuiForm component="form" onSubmit={onSubmit}>
<EuiFormRow
label={i18n.translate('indexEditor.columnHeaderEdit.fieldType', {
defaultMessage: 'Select a field type',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
defaultMessage: 'Select a field type',
defaultMessage: 'Select field type',

Wonder if it would be correct this way for a label too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this one 🙏

@elastic-vault-github-plugin-prod elastic-vault-github-plugin-prod bot requested a review from a team as a code owner November 26, 2025 09:37
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-management-team (Team:obs-ux-management)

Copy link
Contributor Author

@sddonne sddonne Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two changes based on @ninoslavmiskovic feedback:

  • Take out the box from the selected item
Image
  • Don't hide the name input when clearing the field type.

f243793

@darnautov darnautov removed the request for review from a team November 26, 2025 13:01
@sddonne sddonne removed the request for review from a team November 26, 2025 14:01
@sddonne sddonne requested a review from jughosta November 27, 2025 08:25
Copy link
Contributor

@jughosta jughosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@sddonne sddonne enabled auto-merge (squash) November 27, 2025 10:03
@sddonne sddonne merged commit a7f8bb6 into elastic:main Nov 27, 2025
12 checks passed
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
aiops 607 610 +3
apm 2045 2048 +3
cloudSecurityPosture 655 658 +3
datasetQuality 894 897 +3
dataViewManagement 183 186 +3
dataVisualizer 835 838 +3
discover 1845 1848 +3
esql 505 509 +4
esqlDataGrid 280 283 +3
eventAnnotationListing 580 583 +3
lens 1608 1611 +3
maps 1290 1293 +3
ml 2811 2814 +3
observability 1600 1603 +3
presentationUtil 105 108 +3
securitySolution 8431 8434 +3
slo 1314 1317 +3
streamsApp 1096 1099 +3
unifiedDocViewer 404 407 +3
unifiedSearch 532 535 +3
total +61

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/esql-types 73 74 +1
@kbn/field-utils 42 48 +6
total +7

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
aiops 527.4KB 527.6KB +166.0B
apm 2.8MB 2.8MB +166.0B
cloudSecurityPosture 642.7KB 643.0KB +332.0B
datasetQuality 428.4KB 428.6KB +166.0B
dataViewManagement 141.9KB 142.1KB +166.0B
dataVisualizer 596.9KB 597.2KB +332.0B
discover 1.2MB 1.2MB +332.0B
enterpriseSearch 947.1KB 947.2KB +166.0B
esql 668.2KB 669.7KB +1.5KB
esqlDataGrid 149.9KB 150.2KB +332.0B
eventAnnotationListing 206.9KB 207.0KB +166.0B
graph 372.6KB 372.7KB +166.0B
indexManagement 707.8KB 707.9KB +166.0B
lens 1.6MB 1.6MB +166.0B
maps 3.1MB 3.1MB +166.0B
ml 5.6MB 5.6MB +332.0B
presentationUtil 67.9KB 68.1KB +166.0B
securitySolution 11.1MB 11.1MB +166.0B
slo 988.3KB 988.7KB +332.0B
stackAlerts 68.9KB 69.1KB +166.0B
streamsApp 1.0MB 1.0MB +166.0B
transform 624.9KB 625.1KB +166.0B
unifiedDocViewer 276.0KB 276.2KB +166.0B
unifiedSearch 393.0KB 393.2KB +166.0B
workflowsManagement 2.1MB 2.1MB +166.0B
total +6.3KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
esql 18.8KB 18.8KB +34.0B
osquery 42.8KB 43.0KB +166.0B
total +200.0B
Unknown metric groups

API count

id before after diff
@kbn/esql-types 76 77 +1
@kbn/field-utils 51 58 +7
total +8

ESLint disabled line counts

id before after diff
@kbn/index-editor 3 4 +1

Total ESLint disabled count

id before after diff
@kbn/index-editor 3 4 +1

History

cc @sddonne

tkajtoch pushed a commit to tkajtoch/kibana that referenced this pull request Dec 1, 2025
## Summary
Now it's possible to select the column type in the Lookup Index Editor,
instead of relying in ES dynamic mapping.


![column-types](https://github.com/user-attachments/assets/74179fcc-3827-4800-b966-3e21b78d39af)

### Known Limitations
Field types that are not supported by ES|QL are allowed to be selected,
and values can be pushed to the index, but are not going to be visible
neither in Discover or if the flyout is reopened.

<img width="415" height="668" alt="image"
src="https://github.com/user-attachments/assets/593f31ea-c29c-418b-a75e-f040cd91806d"
/>
 


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Stratou <efstratia.kalafateli@elastic.co>
JordanSh pushed a commit to JordanSh/kibana that referenced this pull request Dec 9, 2025
## Summary
Now it's possible to select the column type in the Lookup Index Editor,
instead of relying in ES dynamic mapping.


![column-types](https://github.com/user-attachments/assets/74179fcc-3827-4800-b966-3e21b78d39af)

### Known Limitations
Field types that are not supported by ES|QL are allowed to be selected,
and values can be pushed to the index, but are not going to be visible
neither in Discover or if the flyout is reopened.

<img width="415" height="668" alt="image"
src="https://github.com/user-attachments/assets/593f31ea-c29c-418b-a75e-f040cd91806d"
/>
 


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Stratou <efstratia.kalafateli@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:ES|QL ES|QL related features in Kibana needs_docs release_note:enhancement Team:ESQL ES|QL related features in Kibana t// v9.3.0

8 participants