Skip to content

Commit

Permalink
[8.x] Add autocomplete suggestions for dense_vector type (#190769) (#…
Browse files Browse the repository at this point in the history
…193570)

# Backport

This will backport the following commits from `main` to `8.x`:
- [Add autocomplete suggestions for dense_vector type
(#190769)](#190769)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Youhei
Sakurai","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-20T13:04:30Z","message":"Add
autocomplete suggestions for dense_vector type (#190769)\n\nThis PR adds
autocomplete for `dense_vector` type.\r\n\r\nCloses
https://github.com/elastic/kibana/issues/190763\r\n\r\n---------\r\n\r\nCo-authored-by:
Quentin Pradet
<[email protected]>","sha":"9cfd40937522276d0d78c5aae2bd5142623d8c91","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","Feature:Console","Feature:Dev
Tools","enhancement","v9.0.0","backport:prev-minor","v8.16.0"],"title":"Add
autocomplete suggestions for dense_vector
type","number":190769,"url":"https://github.com/elastic/kibana/pull/190769","mergeCommit":{"message":"Add
autocomplete suggestions for dense_vector type (#190769)\n\nThis PR adds
autocomplete for `dense_vector` type.\r\n\r\nCloses
https://github.com/elastic/kibana/issues/190763\r\n\r\n---------\r\n\r\nCo-authored-by:
Quentin Pradet
<[email protected]>","sha":"9cfd40937522276d0d78c5aae2bd5142623d8c91"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/190769","number":190769,"mergeCommit":{"message":"Add
autocomplete suggestions for dense_vector type (#190769)\n\nThis PR adds
autocomplete for `dense_vector` type.\r\n\r\nCloses
https://github.com/elastic/kibana/issues/190763\r\n\r\n---------\r\n\r\nCo-authored-by:
Quentin Pradet
<[email protected]>","sha":"9cfd40937522276d0d78c5aae2bd5142623d8c91"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Youhei Sakurai <[email protected]>
  • Loading branch information
kibanamachine and sakurai-youhei authored Sep 20, 2024
1 parent 9abf5c2 commit 66bcbba
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions src/plugins/console/server/lib/spec_definitions/js/mappings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const mappings = (specService: SpecDefinitionsService) => {
'nested',
'geo_point',
'geo_shape',
'dense_vector',
],
},

Expand All @@ -85,7 +86,24 @@ export const mappings = (specService: SpecDefinitionsService) => {
// index_prefixes: { min_chars, max_chars },

index_options: {
__one_of: ['docs', 'freqs', 'positions'],
// leave the first item blank because the default depends on type
__one_of: [
'',
// text-based types
'docs',
'freqs',
'positions',
'offsets',
// dense_vector type
{
type: {
__one_of: ['int8_hnsw', 'hnsw', 'int4_hnsw', 'flat', 'int8_flat', 'int4_flat'],
},
m: 16,
ef_construction: 100,
confidence_interval: 0,
},
],
},
analyzer: 'standard',
search_analyzer: 'standard',
Expand Down Expand Up @@ -215,7 +233,18 @@ export const mappings = (specService: SpecDefinitionsService) => {
},
},
similarity: {
__one_of: ['default', 'BM25'],
// leave the first item blank because the default depends on type
__one_of: [
'',
// text-based types
'BM25',
'boolean',
// dense_vector type
'l2_norm',
'dot_product',
'cosine',
'max_inner_product',
],
},

// objects
Expand All @@ -234,6 +263,12 @@ export const mappings = (specService: SpecDefinitionsService) => {
// nested
include_in_parent: BOOLEAN,
include_in_root: BOOLEAN,

// dense_vector
element_type: {
__one_of: ['float', 'byte', 'bit'],
},
dims: 3,
},
},
},
Expand Down

0 comments on commit 66bcbba

Please sign in to comment.