[8.x] [Obs AI Assistant] Use `sparse_vector` instead of `text_expansion` (#202891) (#205758)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Obs AI Assistant] Use `sparse_vector` instead of
`text_expansion`
(#202891)](https://github.com/elastic/kibana/pull/202891)

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

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

<!--BACKPORT [{"author":{"name":"Søren
Louv-Jansen","email":"soren.louv@elastic.co"},"sourceCommit":{"committedDate":"2025-01-07T14:35:38Z","message":"[Obs
AI Assistant] Use `sparse_vector` instead of `text_expansion`
(#202891)\n\nCloses #202313\n\nThe [text
expansion\nquery](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-text-expansion-query.html)\nwas
deprecated in 8.15 and is being replaced by [sparse
vector\nquery](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-sparse-vector-query.html).","sha":"30c7ce6a15b7c0491657351866bce87e8b3befd0","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","Team:Obs
AI Assistant","ci:project-deploy-observability"],"title":"[Obs AI
Assistant] Use `sparse_vector` instead of
`text_expansion`","number":202891,"url":"https://github.com/elastic/kibana/pull/202891","mergeCommit":{"message":"[Obs
AI Assistant] Use `sparse_vector` instead of `text_expansion`
(#202891)\n\nCloses #202313\n\nThe [text
expansion\nquery](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-text-expansion-query.html)\nwas
deprecated in 8.15 and is being replaced by [sparse
vector\nquery](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-sparse-vector-query.html).","sha":"30c7ce6a15b7c0491657351866bce87e8b3befd0"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/202891","number":202891,"mergeCommit":{"message":"[Obs
AI Assistant] Use `sparse_vector` instead of `text_expansion`
(#202891)\n\nCloses #202313\n\nThe [text
expansion\nquery](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-text-expansion-query.html)\nwas
deprecated in 8.15 and is being replaced by [sparse
vector\nquery](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-sparse-vector-query.html).","sha":"30c7ce6a15b7c0491657351866bce87e8b3befd0"}}]}]
BACKPORT-->

Co-authored-by: Søren Louv-Jansen <soren.louv@elastic.co>
This commit is contained in:
Kibana Machine 2025-01-08 03:36:13 +11:00 committed by GitHub
parent b74ac18290
commit b2d1a03ba1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -155,12 +155,11 @@ async function recallFromLegacyConnectors({
bool: {
should: [
{
text_expansion: {
[vectorField]: {
model_text: text,
model_id: modelId,
boost,
},
sparse_vector: {
field: vectorField,
query: text,
inference_id: modelId,
boost,
},
},
],