Skip to content

[8.19] [Obs AI Assistant] Use update-by-query for semantic_text migration (#220255)#220640

Merged
sorenlouv merged 3 commits intoelastic:8.19from
sorenlouv:backport/8.19/pr-220255
May 14, 2025
Merged

[8.19] [Obs AI Assistant] Use update-by-query for semantic_text migration (#220255)#220640
sorenlouv merged 3 commits intoelastic:8.19from
sorenlouv:backport/8.19/pr-220255

Conversation

@sorenlouv
Copy link
Member

Backport

This will backport the following commits from main to 8.19:

Questions ?

Please refer to the Backport tool documentation

…lastic#220255)

Closes: elastic#220339

**Background**
The `semantic_text` migration will migrate content from `text` field to
`semantic_text` field. It does so with a recursive function that
continuously retrieves knowledge base entries if they do not contain
`semantic_text` and updates them accordingly.

**Problem**
It is possible to save empty knowledge base entries
(elastic#220342) where `text` and
`semantic_text` will be empty. Doing this will cause the migration
script to run indefinitely leading to OOM on the affected clusters.

## Workarounds for clusters that cannot / won't upgrade

Temporary workaround is to delete empty knowledge base entries:

```jsonc
POST .kibana-observability-ai-assistant-kb/_delete_by_query
{
  "query": {
    "bool": {
      "must": [{ "exists": { "field": "text" }}],
      "must_not": [ { "wildcard": { "text": "*" } }
      ]
    }
  }
}
```

If you want to perform a dry run (find offending documents without
deleting them) run this:
```jsonc
GET .kibana-observability-ai-assistant-kb/_search
{
  "query": {
    "bool": {
      "must": [{ "exists": { "field": "text" }}],
      "must_not": [ { "wildcard": { "text": "*" } }
      ]
    }
  }
}
```

(cherry picked from commit 96d1692)
@sorenlouv sorenlouv requested a review from kibanamachine as a code owner May 9, 2025 10:45
@sorenlouv sorenlouv added the backport This PR is a backport of another PR label May 9, 2025
@sorenlouv sorenlouv enabled auto-merge (squash) May 9, 2025 10:45
@botelastic botelastic bot added the Team:Obs AI Assistant Observability AI Assistant label May 9, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ai-assistant (Team:Obs AI Assistant)

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #39 / home app Welcome interstitial clicking on "Explore on my own" redirects to the "home" page

Metrics [docs]

✅ unchanged

@sorenlouv sorenlouv merged commit f10bff1 into elastic:8.19 May 14, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR Team:Obs AI Assistant Observability AI Assistant

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants