Skip to content

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

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

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

Conversation

@sorenlouv
Copy link
Member

Backport

This will backport the following commits from main to 8.18:

Questions ?

Please refer to the Backport tool documentation

sorenlouv and others added 2 commits May 9, 2025 13:41
…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.

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 11: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 11: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)

@sorenlouv sorenlouv merged commit 16ef18d into elastic:8.18 May 14, 2025
6 checks passed
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #74 / Alerting alerts_as_data alerts as data flapping should set flapping and flapping_history for flapping alerts that settle on active

Metrics [docs]

✅ unchanged

History

@sorenlouv sorenlouv deleted the backport/8.18/pr-220255 branch May 14, 2025 14:08
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