Skip to content

Commit

Permalink
[ES|QL] Add _score in the autocomplete (elastic#212741)
Browse files Browse the repository at this point in the history
## Summary

Adding _score in the metadata autocomplete suggestions

<img width="948" alt="image"
src="https://github.com/user-attachments/assets/58174ab8-72fc-4c84-81e6-6e6fba5e0cde"
/>
  • Loading branch information
stratoula authored Mar 3, 2025
1 parent 642e8f9 commit 6efa46a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -959,9 +959,10 @@ describe('autocomplete', () => {
{ filterText: '_source', text: '_source, ', command: TRIGGER_SUGGESTION_COMMAND },
]);
// no comma if there are no more fields
testSuggestions('FROM a METADATA _id, _ignored, _index, _source, _index_mode, _version/', [
{ filterText: '_version', text: '_version | ', command: TRIGGER_SUGGESTION_COMMAND },
]);
testSuggestions(
'FROM a METADATA _id, _ignored, _index, _source, _index_mode, _score, _version/',
[{ filterText: '_version', text: '_version | ', command: TRIGGER_SUGGESTION_COMMAND }]
);
});

describe.each(['KEEP', 'DROP'])('%s <field>', (commandName) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ export const SINGLE_TICK_REGEX = /`/g;
export const DOUBLE_BACKTICK = '``';
export const SINGLE_BACKTICK = '`';

export const METADATA_FIELDS = ['_version', '_id', '_index', '_source', '_ignored', '_index_mode'];
export const METADATA_FIELDS = [
'_version',
'_id',
'_index',
'_source',
'_ignored',
'_index_mode',
'_score',
];

export const FULL_TEXT_SEARCH_FUNCTIONS = ['match', 'match_operator', 'qstr', 'kql'];
export const UNSUPPORTED_COMMANDS_BEFORE_QSTR = new Set([
Expand Down

0 comments on commit 6efa46a

Please sign in to comment.