diff --git a/x-pack/plugins/elastic_assistant/server/ai_assistant_data_clients/knowledge_base/create_knowledge_base_entry.ts b/x-pack/plugins/elastic_assistant/server/ai_assistant_data_clients/knowledge_base/create_knowledge_base_entry.ts index 09bb5b291ef9a..ce0ce394ef833 100644 --- a/x-pack/plugins/elastic_assistant/server/ai_assistant_data_clients/knowledge_base/create_knowledge_base_entry.ts +++ b/x-pack/plugins/elastic_assistant/server/ai_assistant_data_clients/knowledge_base/create_knowledge_base_entry.ts @@ -143,7 +143,10 @@ export const getUpdateScript = ({ return { doc: { ...entry, - semantic_text: entry.text, + // Seems like ES bulk update requires the `semantic_text` type fields to be specified + // even when they are not required in mapping configs. + // Since `semantic_text` is an optional field for index entries, we pass a dummy text to avoid ES error. + ...(entry.type === 'index' ? { semantic_text: 'a' } : { semantic_text: entry.text }), }, }; };