[Obs AI Assistant] Use update-by-query for semantic_text migration#220255
Conversation
|
Pinging @elastic/obs-ai-assistant (Team:Obs AI Assistant) |
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
There was a problem hiding this comment.
I've verified that the inifnite loop doesn't happen anymore.
Steps I tested:
- Checkout
main - Create a user instructions
- Clear the user instruction by clearing the text
- Re-start kibana
- Noticed the infinite loop
Next:
- Checked out this PR
- Re-started Kibana
- There was no infinite loop in the migration ✅
However, I did notice a log related to a lock can't be released. Made a comment about it.
...lity_ai_assistant/server/service/startup_migrations/populate_missing_semantic_text_fields.ts
Show resolved
Hide resolved
...lity_ai_assistant/server/service/startup_migrations/populate_missing_semantic_text_fields.ts
Show resolved
Hide resolved
Thank you so much for manually testing this flow. Much appreciated!
|
…ext-migration-to-update-by-query
💚 Build Succeeded
Metrics [docs]
History
|
Anytime :)
Awesome, thanks @sorenlouv |
|
Starting backport for target branches: 8.17, 8.18, 8.19, 9.0 https://github.com/elastic/kibana/actions/runs/14916851839 |
💔 All backports failed
Manual backportTo create the backport manually run: 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)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
💔 Some backports could not be created
Note: Successful backport PRs will be merged automatically after passing CI. Manual backportTo create the backport manually run: 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. 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)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. 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. 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)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. 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. 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)
…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": "*" } } ] } } } ```
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
1 similar comment
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
…tion (#220255) (#220642) # Backport This will backport the following commits from `main` to `8.17`: - [[Obs AI Assistant] Use update-by-query for semantic_text migration (#220255)](#220255) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Søren Louv-Jansen","email":"soren.louv@elastic.co"},"sourceCommit":{"committedDate":"2025-05-08T21:52:33Z","message":"[Obs AI Assistant] Use update-by-query for semantic_text migration (#220255)\n\nCloses: https://github.com/elastic/kibana/issues/220339\n\n**Background**\nThe `semantic_text` migration will migrate content from `text` field to\n`semantic_text` field. It does so with a recursive function that\ncontinuously retrieves knowledge base entries if they do not contain\n`semantic_text` and updates them accordingly.\n\n**Problem**\nIt is possible to save empty knowledge base entries\n(#220342) where `text` and\n`semantic_text` will be empty. Doing this will cause the migration\nscript to run indefinitely leading to OOM on the affected clusters.\n\n## Workarounds for clusters that cannot / won't upgrade\n\nTemporary workaround is to delete empty knowledge base entries:\n\n```jsonc\nPOST .kibana-observability-ai-assistant-kb/_delete_by_query\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```\n\nIf you want to perform a dry run (find offending documents without\ndeleting them) run this:\n```jsonc\nGET .kibana-observability-ai-assistant-kb/_search\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```","sha":"96d1692ae20172ea3d8a5f7062c55c10d38ed9a2","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Obs AI Assistant","ci:project-deploy-observability","backport:version","v9.1.0","v8.19.0","v8.17.7","v8.18.2","v9.0.2"],"title":"[Obs AI Assistant] Use update-by-query for semantic_text migration","number":220255,"url":"https://github.com/elastic/kibana/pull/220255","mergeCommit":{"message":"[Obs AI Assistant] Use update-by-query for semantic_text migration (#220255)\n\nCloses: https://github.com/elastic/kibana/issues/220339\n\n**Background**\nThe `semantic_text` migration will migrate content from `text` field to\n`semantic_text` field. It does so with a recursive function that\ncontinuously retrieves knowledge base entries if they do not contain\n`semantic_text` and updates them accordingly.\n\n**Problem**\nIt is possible to save empty knowledge base entries\n(#220342) where `text` and\n`semantic_text` will be empty. Doing this will cause the migration\nscript to run indefinitely leading to OOM on the affected clusters.\n\n## Workarounds for clusters that cannot / won't upgrade\n\nTemporary workaround is to delete empty knowledge base entries:\n\n```jsonc\nPOST .kibana-observability-ai-assistant-kb/_delete_by_query\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```\n\nIf you want to perform a dry run (find offending documents without\ndeleting them) run this:\n```jsonc\nGET .kibana-observability-ai-assistant-kb/_search\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```","sha":"96d1692ae20172ea3d8a5f7062c55c10d38ed9a2"}},"sourceBranch":"main","suggestedTargetBranches":["8.17","8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/220255","number":220255,"mergeCommit":{"message":"[Obs AI Assistant] Use update-by-query for semantic_text migration (#220255)\n\nCloses: https://github.com/elastic/kibana/issues/220339\n\n**Background**\nThe `semantic_text` migration will migrate content from `text` field to\n`semantic_text` field. It does so with a recursive function that\ncontinuously retrieves knowledge base entries if they do not contain\n`semantic_text` and updates them accordingly.\n\n**Problem**\nIt is possible to save empty knowledge base entries\n(#220342) where `text` and\n`semantic_text` will be empty. Doing this will cause the migration\nscript to run indefinitely leading to OOM on the affected clusters.\n\n## Workarounds for clusters that cannot / won't upgrade\n\nTemporary workaround is to delete empty knowledge base entries:\n\n```jsonc\nPOST .kibana-observability-ai-assistant-kb/_delete_by_query\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```\n\nIf you want to perform a dry run (find offending documents without\ndeleting them) run this:\n```jsonc\nGET .kibana-observability-ai-assistant-kb/_search\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```","sha":"96d1692ae20172ea3d8a5f7062c55c10d38ed9a2"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/220640","number":220640,"state":"OPEN"},{"branch":"8.17","label":"v8.17.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: Viduni Wickramarachchi <viduni.wickramarachchi@elastic.co>
…tion (#220255) (#220646) # Backport This will backport the following commits from `main` to `8.18`: - [[Obs AI Assistant] Use update-by-query for semantic_text migration (#220255)](#220255) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Søren Louv-Jansen","email":"soren.louv@elastic.co"},"sourceCommit":{"committedDate":"2025-05-08T21:52:33Z","message":"[Obs AI Assistant] Use update-by-query for semantic_text migration (#220255)\n\nCloses: https://github.com/elastic/kibana/issues/220339\n\n**Background**\nThe `semantic_text` migration will migrate content from `text` field to\n`semantic_text` field. It does so with a recursive function that\ncontinuously retrieves knowledge base entries if they do not contain\n`semantic_text` and updates them accordingly.\n\n**Problem**\nIt is possible to save empty knowledge base entries\n(#220342) where `text` and\n`semantic_text` will be empty. Doing this will cause the migration\nscript to run indefinitely leading to OOM on the affected clusters.\n\n## Workarounds for clusters that cannot / won't upgrade\n\nTemporary workaround is to delete empty knowledge base entries:\n\n```jsonc\nPOST .kibana-observability-ai-assistant-kb/_delete_by_query\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```\n\nIf you want to perform a dry run (find offending documents without\ndeleting them) run this:\n```jsonc\nGET .kibana-observability-ai-assistant-kb/_search\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```","sha":"96d1692ae20172ea3d8a5f7062c55c10d38ed9a2","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Obs AI Assistant","ci:project-deploy-observability","backport:version","v9.1.0","v8.19.0","v8.17.7","v8.18.2","v9.0.2"],"title":"[Obs AI Assistant] Use update-by-query for semantic_text migration","number":220255,"url":"https://github.com/elastic/kibana/pull/220255","mergeCommit":{"message":"[Obs AI Assistant] Use update-by-query for semantic_text migration (#220255)\n\nCloses: https://github.com/elastic/kibana/issues/220339\n\n**Background**\nThe `semantic_text` migration will migrate content from `text` field to\n`semantic_text` field. It does so with a recursive function that\ncontinuously retrieves knowledge base entries if they do not contain\n`semantic_text` and updates them accordingly.\n\n**Problem**\nIt is possible to save empty knowledge base entries\n(#220342) where `text` and\n`semantic_text` will be empty. Doing this will cause the migration\nscript to run indefinitely leading to OOM on the affected clusters.\n\n## Workarounds for clusters that cannot / won't upgrade\n\nTemporary workaround is to delete empty knowledge base entries:\n\n```jsonc\nPOST .kibana-observability-ai-assistant-kb/_delete_by_query\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```\n\nIf you want to perform a dry run (find offending documents without\ndeleting them) run this:\n```jsonc\nGET .kibana-observability-ai-assistant-kb/_search\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```","sha":"96d1692ae20172ea3d8a5f7062c55c10d38ed9a2"}},"sourceBranch":"main","suggestedTargetBranches":["8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/220255","number":220255,"mergeCommit":{"message":"[Obs AI Assistant] Use update-by-query for semantic_text migration (#220255)\n\nCloses: https://github.com/elastic/kibana/issues/220339\n\n**Background**\nThe `semantic_text` migration will migrate content from `text` field to\n`semantic_text` field. It does so with a recursive function that\ncontinuously retrieves knowledge base entries if they do not contain\n`semantic_text` and updates them accordingly.\n\n**Problem**\nIt is possible to save empty knowledge base entries\n(#220342) where `text` and\n`semantic_text` will be empty. Doing this will cause the migration\nscript to run indefinitely leading to OOM on the affected clusters.\n\n## Workarounds for clusters that cannot / won't upgrade\n\nTemporary workaround is to delete empty knowledge base entries:\n\n```jsonc\nPOST .kibana-observability-ai-assistant-kb/_delete_by_query\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```\n\nIf you want to perform a dry run (find offending documents without\ndeleting them) run this:\n```jsonc\nGET .kibana-observability-ai-assistant-kb/_search\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```","sha":"96d1692ae20172ea3d8a5f7062c55c10d38ed9a2"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/220640","number":220640,"state":"OPEN"},{"branch":"8.17","label":"v8.17.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/220642","number":220642,"state":"OPEN"},{"branch":"8.18","label":"v8.18.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: Viduni Wickramarachchi <viduni.wickramarachchi@elastic.co>
…tion (#220255) (#220640) # Backport This will backport the following commits from `main` to `8.19`: - [[Obs AI Assistant] Use update-by-query for semantic_text migration (#220255)](#220255) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Søren Louv-Jansen","email":"soren.louv@elastic.co"},"sourceCommit":{"committedDate":"2025-05-08T21:52:33Z","message":"[Obs AI Assistant] Use update-by-query for semantic_text migration (#220255)\n\nCloses: https://github.com/elastic/kibana/issues/220339\n\n**Background**\nThe `semantic_text` migration will migrate content from `text` field to\n`semantic_text` field. It does so with a recursive function that\ncontinuously retrieves knowledge base entries if they do not contain\n`semantic_text` and updates them accordingly.\n\n**Problem**\nIt is possible to save empty knowledge base entries\n(#220342) where `text` and\n`semantic_text` will be empty. Doing this will cause the migration\nscript to run indefinitely leading to OOM on the affected clusters.\n\n## Workarounds for clusters that cannot / won't upgrade\n\nTemporary workaround is to delete empty knowledge base entries:\n\n```jsonc\nPOST .kibana-observability-ai-assistant-kb/_delete_by_query\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```\n\nIf you want to perform a dry run (find offending documents without\ndeleting them) run this:\n```jsonc\nGET .kibana-observability-ai-assistant-kb/_search\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```","sha":"96d1692ae20172ea3d8a5f7062c55c10d38ed9a2","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Obs AI Assistant","ci:project-deploy-observability","backport:version","v9.1.0","v8.19.0","v8.17.7","v8.18.2","v9.0.2"],"title":"[Obs AI Assistant] Use update-by-query for semantic_text migration","number":220255,"url":"https://github.com/elastic/kibana/pull/220255","mergeCommit":{"message":"[Obs AI Assistant] Use update-by-query for semantic_text migration (#220255)\n\nCloses: https://github.com/elastic/kibana/issues/220339\n\n**Background**\nThe `semantic_text` migration will migrate content from `text` field to\n`semantic_text` field. It does so with a recursive function that\ncontinuously retrieves knowledge base entries if they do not contain\n`semantic_text` and updates them accordingly.\n\n**Problem**\nIt is possible to save empty knowledge base entries\n(#220342) where `text` and\n`semantic_text` will be empty. Doing this will cause the migration\nscript to run indefinitely leading to OOM on the affected clusters.\n\n## Workarounds for clusters that cannot / won't upgrade\n\nTemporary workaround is to delete empty knowledge base entries:\n\n```jsonc\nPOST .kibana-observability-ai-assistant-kb/_delete_by_query\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```\n\nIf you want to perform a dry run (find offending documents without\ndeleting them) run this:\n```jsonc\nGET .kibana-observability-ai-assistant-kb/_search\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```","sha":"96d1692ae20172ea3d8a5f7062c55c10d38ed9a2"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","8.17","8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/220255","number":220255,"mergeCommit":{"message":"[Obs AI Assistant] Use update-by-query for semantic_text migration (#220255)\n\nCloses: https://github.com/elastic/kibana/issues/220339\n\n**Background**\nThe `semantic_text` migration will migrate content from `text` field to\n`semantic_text` field. It does so with a recursive function that\ncontinuously retrieves knowledge base entries if they do not contain\n`semantic_text` and updates them accordingly.\n\n**Problem**\nIt is possible to save empty knowledge base entries\n(#220342) where `text` and\n`semantic_text` will be empty. Doing this will cause the migration\nscript to run indefinitely leading to OOM on the affected clusters.\n\n## Workarounds for clusters that cannot / won't upgrade\n\nTemporary workaround is to delete empty knowledge base entries:\n\n```jsonc\nPOST .kibana-observability-ai-assistant-kb/_delete_by_query\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```\n\nIf you want to perform a dry run (find offending documents without\ndeleting them) run this:\n```jsonc\nGET .kibana-observability-ai-assistant-kb/_search\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```","sha":"96d1692ae20172ea3d8a5f7062c55c10d38ed9a2"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.17","label":"v8.17.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: Viduni Wickramarachchi <viduni.wickramarachchi@elastic.co>
…ion (#220255) (#220647) # Backport This will backport the following commits from `main` to `9.0`: - [[Obs AI Assistant] Use update-by-query for semantic_text migration (#220255)](#220255) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Søren Louv-Jansen","email":"soren.louv@elastic.co"},"sourceCommit":{"committedDate":"2025-05-08T21:52:33Z","message":"[Obs AI Assistant] Use update-by-query for semantic_text migration (#220255)\n\nCloses: https://github.com/elastic/kibana/issues/220339\n\n**Background**\nThe `semantic_text` migration will migrate content from `text` field to\n`semantic_text` field. It does so with a recursive function that\ncontinuously retrieves knowledge base entries if they do not contain\n`semantic_text` and updates them accordingly.\n\n**Problem**\nIt is possible to save empty knowledge base entries\n(#220342) where `text` and\n`semantic_text` will be empty. Doing this will cause the migration\nscript to run indefinitely leading to OOM on the affected clusters.\n\n## Workarounds for clusters that cannot / won't upgrade\n\nTemporary workaround is to delete empty knowledge base entries:\n\n```jsonc\nPOST .kibana-observability-ai-assistant-kb/_delete_by_query\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```\n\nIf you want to perform a dry run (find offending documents without\ndeleting them) run this:\n```jsonc\nGET .kibana-observability-ai-assistant-kb/_search\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```","sha":"96d1692ae20172ea3d8a5f7062c55c10d38ed9a2","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Obs AI Assistant","ci:project-deploy-observability","backport:version","v9.1.0","v8.19.0","v8.17.7","v8.18.2","v9.0.2"],"title":"[Obs AI Assistant] Use update-by-query for semantic_text migration","number":220255,"url":"https://github.com/elastic/kibana/pull/220255","mergeCommit":{"message":"[Obs AI Assistant] Use update-by-query for semantic_text migration (#220255)\n\nCloses: https://github.com/elastic/kibana/issues/220339\n\n**Background**\nThe `semantic_text` migration will migrate content from `text` field to\n`semantic_text` field. It does so with a recursive function that\ncontinuously retrieves knowledge base entries if they do not contain\n`semantic_text` and updates them accordingly.\n\n**Problem**\nIt is possible to save empty knowledge base entries\n(#220342) where `text` and\n`semantic_text` will be empty. Doing this will cause the migration\nscript to run indefinitely leading to OOM on the affected clusters.\n\n## Workarounds for clusters that cannot / won't upgrade\n\nTemporary workaround is to delete empty knowledge base entries:\n\n```jsonc\nPOST .kibana-observability-ai-assistant-kb/_delete_by_query\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```\n\nIf you want to perform a dry run (find offending documents without\ndeleting them) run this:\n```jsonc\nGET .kibana-observability-ai-assistant-kb/_search\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```","sha":"96d1692ae20172ea3d8a5f7062c55c10d38ed9a2"}},"sourceBranch":"main","suggestedTargetBranches":["9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/220255","number":220255,"mergeCommit":{"message":"[Obs AI Assistant] Use update-by-query for semantic_text migration (#220255)\n\nCloses: https://github.com/elastic/kibana/issues/220339\n\n**Background**\nThe `semantic_text` migration will migrate content from `text` field to\n`semantic_text` field. It does so with a recursive function that\ncontinuously retrieves knowledge base entries if they do not contain\n`semantic_text` and updates them accordingly.\n\n**Problem**\nIt is possible to save empty knowledge base entries\n(#220342) where `text` and\n`semantic_text` will be empty. Doing this will cause the migration\nscript to run indefinitely leading to OOM on the affected clusters.\n\n## Workarounds for clusters that cannot / won't upgrade\n\nTemporary workaround is to delete empty knowledge base entries:\n\n```jsonc\nPOST .kibana-observability-ai-assistant-kb/_delete_by_query\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```\n\nIf you want to perform a dry run (find offending documents without\ndeleting them) run this:\n```jsonc\nGET .kibana-observability-ai-assistant-kb/_search\n{\n \"query\": {\n \"bool\": {\n \"must\": [{ \"exists\": { \"field\": \"text\" }}],\n \"must_not\": [ { \"wildcard\": { \"text\": \"*\" } }\n ]\n }\n }\n}\n```","sha":"96d1692ae20172ea3d8a5f7062c55c10d38ed9a2"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/220640","number":220640,"state":"OPEN"},{"branch":"8.17","label":"v8.17.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/220642","number":220642,"state":"OPEN"},{"branch":"8.18","label":"v8.18.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/220646","number":220646,"state":"OPEN"},{"branch":"9.0","label":"v9.0.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: Viduni Wickramarachchi <viduni.wickramarachchi@elastic.co>
|
Follow-up to avoid excessive error messages: #221152 |
## Background The semantic text migration was added in 8.17 along with the move to semantic_text field (#186499). ## Suggestion We should remove the semantic_text migration starting in 9.1. Reasons: - The migration has recently caused severe disruption on a number of clusters (#220255). - The migration may no longer be needed. Users are required to upgrade Elasticsearch to 8.18 in order to update to 9.0, or 8.19 to upgrade to 9.1. This could mean that users are guaranteed to have run the migration previously, when upgrading Kibana to 9.1 (needs to be double checked with Kibana folks) --------- Co-authored-by: Viduni Wickramarachchi <viduni.ushanka@gmail.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
…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": "*" } } ] } } } ```
## Background The semantic text migration was added in 8.17 along with the move to semantic_text field (elastic#186499). ## Suggestion We should remove the semantic_text migration starting in 9.1. Reasons: - The migration has recently caused severe disruption on a number of clusters (elastic#220255). - The migration may no longer be needed. Users are required to upgrade Elasticsearch to 8.18 in order to update to 9.0, or 8.19 to upgrade to 9.1. This could mean that users are guaranteed to have run the migration previously, when upgrading Kibana to 9.1 (needs to be double checked with Kibana folks) --------- Co-authored-by: Viduni Wickramarachchi <viduni.ushanka@gmail.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
…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": "*" } } ] } } } ```
## Background The semantic text migration was added in 8.17 along with the move to semantic_text field (elastic#186499). ## Suggestion We should remove the semantic_text migration starting in 9.1. Reasons: - The migration has recently caused severe disruption on a number of clusters (elastic#220255). - The migration may no longer be needed. Users are required to upgrade Elasticsearch to 8.18 in order to update to 9.0, or 8.19 to upgrade to 9.1. This could mean that users are guaranteed to have run the migration previously, when upgrading Kibana to 9.1 (needs to be double checked with Kibana folks) --------- Co-authored-by: Viduni Wickramarachchi <viduni.ushanka@gmail.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Closes: #220339
Background
The
semantic_textmigration will migrate content fromtextfield tosemantic_textfield. It does so with a recursive function that continuously retrieves knowledge base entries if they do not containsemantic_textand updates them accordingly.Problem
It is possible to save empty knowledge base entries (#220342) where
textandsemantic_textwill be empty. Doing this will cause the migration script to run indefinitely leading to OOM on the affected clusters.Solution
Rewrite the recursive function to updateByQuery where Elasticsearch will paginate through entries and updating them.
Workarounds for clusters that cannot / won't upgrade
Temporary workaround is to delete empty knowledge base entries:
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:
GET .kibana-observability-ai-assistant-kb/_search { "query": { "bool": { "must": [{ "exists": { "field": "text" }}], "must_not": [ { "wildcard": { "text": "*" } } ] } } }