[ES|QL] Index editor - Allow selecting column type#241637
[ES|QL] Index editor - Allow selecting column type#241637sddonne merged 67 commits intoelastic:mainfrom
Conversation
| }); | ||
|
|
||
| it('should display placeholder when no type is selected', () => { | ||
| render(<FieldSelect selectedType={null} onTypeChange={mockOnTypeChange} />); |
There was a problem hiding this comment.
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);
});
...
}
AlexGPlay
left a comment
There was a problem hiding this comment.
code review only LGTM but not sure if anyone with more context wants to double check this
jughosta
left a comment
There was a problem hiding this comment.
Nice addition to the flow!
| { | ||
| 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'], | ||
| }, |
There was a problem hiding this comment.
This grouping is a bit confusing. Can we have them separately?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
According to our docs it would be Object.
| defaultMessage: 'Structured', | |
| defaultMessage: 'Object', |
| data-test-subj="indexEditorColumnNameInput" | ||
| value={columnName} | ||
| placeholder={i18n.translate('indexEditor.columnHeaderEdit.columnNamePlaceholder', { | ||
| defaultMessage: 'Choose the name of the field', |
There was a problem hiding this comment.
Another option:
| defaultMessage: 'Choose the name of the field', | |
| defaultMessage: 'Enter field name', |
There was a problem hiding this comment.
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 🙏
There was a problem hiding this comment.
Just looked at the designs - We should go with @jughosta's proposal if possible 🙏
| defaultMessage: 'Select a field type', | ||
| })} | ||
| helpText={i18n.translate('indexEditor.columnHeaderEdit.fieldTypeHelpText', { | ||
| defaultMessage: `You won't be able to change the type after saving it.`, |
There was a problem hiding this comment.
| 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.`, |
| <EuiForm component="form" onSubmit={onSubmit}> | ||
| <EuiFormRow | ||
| label={i18n.translate('indexEditor.columnHeaderEdit.fieldType', { | ||
| defaultMessage: 'Select a field type', |
There was a problem hiding this comment.
| defaultMessage: 'Select a field type', | |
| defaultMessage: 'Select field type', |
Wonder if it would be correct this way for a label too.
There was a problem hiding this comment.
Same with this one 🙏
|
Pinging @elastic/obs-ux-management-team (Team:obs-ux-management) |
There was a problem hiding this comment.
Two changes based on @ninoslavmiskovic feedback:
- Take out the box from the selected item
- Don't hide the name input when clearing the field type.
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
cc @sddonne |
## Summary Now it's possible to select the column type in the Lookup Index Editor, instead of relying in ES dynamic mapping.  ### 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>
## Summary Now it's possible to select the column type in the Lookup Index Editor, instead of relying in ES dynamic mapping.  ### 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>
Closes #240784
Summary
Now it's possible to select the column type in the Lookup Index Editor, instead of relying in ES dynamic mapping.
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.
Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.