Skip to content

Conversation

@e40pud
Copy link
Contributor

@e40pud e40pud commented Aug 19, 2025

Summary

Epic: https://github.com/elastic/security-team/issues/12768
Meta: https://github.com/elastic/security-team/issues/13657
RFC: internal link

With these changes we update the conversation summary schema to accommodate new fields to allow conversation summarization and past conversation search. Also, as part of these changes, the OLD (unused) summary fields are removed from the APIs.

Mapping changes

The conversations index mapping already has a summary field which is an object that looks like:

OLD summary schema
"summary": {
  "properties": {
    "@timestamp": {
      "type": "date"
    },
    "confidence": {
      "type": "keyword"
    },
    "content": {
      "type": "text"
    },
    "public": {
      "type": "boolean"
    }
  }
}

To be able to summarize conversations and semantically search through existing summaries, the new fields (semantic_content and summarized_message_ids) are added into the mapping:

Updated summary schema
"summary": {
  "properties": {
    "@timestamp": {
      "type": "date"
    },
    "confidence": {
      "type": "keyword"
    },
    "content": {
      "type": "text"
    },
    "public": {
      "type": "boolean"
    },
    "semantic_content": {
      "type": "semantic_text",
      "inference_id": ".elser-2-elasticsearch"
    },
    "summarized_message_ids": {
      "type": "keyword",
      "array": true
    }
  }
}

New fields description

semantic_content field will be used to store conversation summary and allows semantical search through the ELSER v2 or E5 models.

summarized_message_ids field will contain a list of all messages that are summarized and part of the summary stored within the semantic_content field.

Legacy fields and API interface changes

There are bunch of fields that were never used and won't be supported or used in future - summary.confidence, summary.content and summary.public. After discussion with @YulNaumenko and @elastic/security-generative-ai, this fields will be marked as legacy on the mappings level for compatibility with the installed indices and will be removed on the API level. Previously, we allowed to update summary.confidence, summary.content and summary.public fields via API calls and never used in kibana UI.

NOTE: Thanks @spong to pointing to this cluster to see the API usage in production. It shows that within last 90 days, the update conversation API (the only way for users to update conversations and potentially add a summary to it) was used only 41 times which looks low and I believe negligible.

Screenshot 2025-08-20 at 10 50 35

From now on, the conversation will have next summary fields on the API level:

interface ConversationSummary {
  /**
   * The timestamp summary was updated.
   */
  timestamp: string;

  /**
   * Summary text of the conversation over time.
   */
  semanticContent?: string;

  /**
   * The list of summarized messages.
   */
  summarizedMessageIds?: string[];
}

Testing

To test, you can use next API calls:

Fetch all existing conversations

This call will fetch all existing conversation. Good for overview of existing conversations and verifying expected summary values.

curl --location 'http://localhost:5601/sbb/api/security_ai_assistant/current_user/conversations/_find' \
--header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==' \
--header 'kbn-xsrf: true' \
--header 'elastic-api-version: 2023-10-31'
Update a conversation

This call will update a conversation and add/update a summary.

curl --location --request PUT 'http://localhost:5601/sbb/api/security_ai_assistant/current_user/conversations/{{CONVERSATION_ID}}' \
--header 'kbn-xsrf: true' \
--header 'elastic-api-version: 2023-10-31' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==' \
--data '{
    "id": "a565baa8-5566-47b2-ab69-807248b2fc46",
    "summary": {
        "semanticContent": "Very nice demo semantic content."
    }
}'
Bulk Update existing conversation(s)

This call will update a conversation and add/update a summary.

curl --location 'http://localhost:5601/sbb/internal/elastic_assistant/current_user/conversations/_bulk_action' \
--header 'kbn-xsrf: true' \
--header 'elastic-api-version: 1' \
--header 'x-elastic-internal-origin: Kibana' \
--header 'kbn-version: 9.2.0' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==' \
--data '{
  "update":
    [
        {
            "id": "{{CONVERSATION_ID}}",
            "summary": {
                "semanticContent": "Very nice demo semantic content."
            }
        }
    ]
}'

Some test cases:

  1. Check that if not updated, a new conversation does not have a summary
  2. Check that summary contains expected value after it has been updated via one of the above APIs
  3. Check that we do not return legacy fields (summary.confidence, summary.content and summary.public) even if you add a document with those fields set. You can set legacy fields, either via DevTools or via update APIs from above in previous kibana version.

@e40pud e40pud added this to the 9.2 milestone Aug 19, 2025
@e40pud e40pud self-assigned this Aug 19, 2025
@e40pud e40pud requested a review from a team as a code owner August 19, 2025 16:23
@e40pud e40pud added Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Feature:Security Assistant Security Assistant Team:Security Generative AI Security Generative AI v9.2.0 labels Aug 19, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@e40pud e40pud added release_note:feature Makes this part of the condensed release notes backport:version Backport to applied version labels labels Aug 19, 2025
@e40pud
Copy link
Contributor Author

e40pud commented Aug 19, 2025

cc @pgayvallet keeping you in the loop for the summarization related changes.

@elastic-vault-github-plugin-prod elastic-vault-github-plugin-prod bot requested a review from a team as a code owner August 19, 2025 17:00
@e40pud e40pud added release_note:skip Skip the PR/issue when compiling release notes and removed release_note:feature Makes this part of the condensed release notes labels Aug 20, 2025
@e40pud e40pud requested a review from KDKHD August 22, 2025 09:01
},
'summary.public': {
type: 'boolean',
'summary.semantic_content': {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not applicable to us now since we're deprecating summary.content, but wanted to mention that the common pattern I've seen for when wanting to add embeddings for an existing field you can use copy_to or multi-fields, that way inserts and search stay the same.

@e40pud e40pud requested review from a team as code owners August 27, 2025 09:44
Copy link
Member

@jbudz jbudz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.buildkite/ftr_security_serverless_configs.yml LGTM

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/elastic-assistant-common 676 678 +2

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 10.4MB 10.4MB +9.0B
Unknown metric groups

API count

id before after diff
@kbn/elastic-assistant-common 790 792 +2

ESLint disabled line counts

id before after diff
elasticAssistant 42 41 -1

Total ESLint disabled count

id before after diff
elasticAssistant 50 49 -1

History

cc @e40pud

@e40pud e40pud merged commit 70099fd into elastic:main Aug 27, 2025
12 checks passed
const updatedAt = new Date().toISOString();
const params = transformToUpdateScheme(updatedAt, conversationUpdateProps);

const maxRetries = 3;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering why did you remove this retry logic? Sometimes there can be a conflict when updating the title at the same time as appending a message, for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found this bulk update API option that we can use https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk#operation-bulk-body-application-json-update-retry_on_conflict. Will update bulk updates accordingly.

e40pud added a commit that referenced this pull request Aug 29, 2025
…date (#233288)

## Summary

Part of
Epic: elastic/security-team#12768
Meta: elastic/security-team#13657

In my [previous PR](#232288), I
accidentally removed "retry on conflict"
[logic](https://github.com/elastic/kibana/pull/232288/files#r2305375978).

These changes add a retry logic on bulk update conflicts. For that we
use a `retry_on_conflict` option
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk#operation-bulk-body-application-json-update-retry_on_conflict.
The retry count is set to 3 to match previous behaviour.

cc @stephmilovic
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Aug 29, 2025
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 232288 locally
cc: @e40pud

spong pushed a commit that referenced this pull request Aug 29, 2025
#233428)

## Summary

Epic: elastic/security-team#12768
Meta: elastic/security-team#13657
RFC: [internal
link](https://docs.google.com/document/d/13jAJ5Q3_At_zAuwKjvpYehnM5uzKJSwZIZ1aJJNAf5k)

This PR reverts conversation mappings changes introduced in
#232288. Since we decided to put
on hold the Using Past Conversation as Context feature, we decided to
remove added summary field backed by the `semantic_text` field to avoid
potential issues that users mights have when updating a conversation
while the inference endpoint is not available.

**Changes**:
* Removed mapping fields: `semantic_content` and
`summarized_message_ids`
* As part of these changes, the `summary` field was hidden on the API
level and conversations response object won't have it anymore

---------

Co-authored-by: kibanamachine <[email protected]>
ymao1 pushed a commit to ymao1/kibana that referenced this pull request Aug 29, 2025
…date (elastic#233288)

## Summary

Part of
Epic: elastic/security-team#12768
Meta: elastic/security-team#13657

In my [previous PR](elastic#232288), I
accidentally removed "retry on conflict"
[logic](https://github.com/elastic/kibana/pull/232288/files#r2305375978).

These changes add a retry logic on bulk update conflicts. For that we
use a `retry_on_conflict` option
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk#operation-bulk-body-application-json-update-retry_on_conflict.
The retry count is set to 3 to match previous behaviour.

cc @stephmilovic
ymao1 pushed a commit to ymao1/kibana that referenced this pull request Aug 29, 2025
elastic#233428)

## Summary

Epic: elastic/security-team#12768
Meta: elastic/security-team#13657
RFC: [internal
link](https://docs.google.com/document/d/13jAJ5Q3_At_zAuwKjvpYehnM5uzKJSwZIZ1aJJNAf5k)

This PR reverts conversation mappings changes introduced in
elastic#232288. Since we decided to put
on hold the Using Past Conversation as Context feature, we decided to
remove added summary field backed by the `semantic_text` field to avoid
potential issues that users mights have when updating a conversation
while the inference endpoint is not available.

**Changes**:
* Removed mapping fields: `semantic_content` and
`summarized_message_ids`
* As part of these changes, the `summary` field was hidden on the API
level and conversations response object won't have it anymore

---------

Co-authored-by: kibanamachine <[email protected]>
kowalczyk-krzysztof pushed a commit to kowalczyk-krzysztof/kibana that referenced this pull request Aug 30, 2025
… and interface (elastic#13657) (elastic#232288)

## Summary

Epic: elastic/security-team#12768
Meta: elastic/security-team#13657
RFC: [internal
link](https://docs.google.com/document/d/13jAJ5Q3_At_zAuwKjvpYehnM5uzKJSwZIZ1aJJNAf5k)

With these changes we update the conversation summary schema to
accommodate new fields to allow conversation summarization and past
conversation search. Also, as part of these changes, the OLD (unused)
summary fields are removed from the APIs.

### Mapping changes

The conversations index mapping already has a `summary` field which is
an object that looks like:

<details>
  <summary><b>OLD</b> summary schema</summary>
  
```json
"summary": {
  "properties": {
    "@timestamp": {
      "type": "date"
    },
    "confidence": {
      "type": "keyword"
    },
    "content": {
      "type": "text"
    },
    "public": {
      "type": "boolean"
    }
  }
}
```

</details>

To be able to summarize conversations and semantically search through
existing summaries, the new fields (`semantic_content` and
`summarized_message_ids`) are added into the mapping:

<details>
  <summary><b>Updated</b> summary schema</summary>
  

```json
"summary": {
  "properties": {
    "@timestamp": {
      "type": "date"
    },
    "confidence": {
      "type": "keyword"
    },
    "content": {
      "type": "text"
    },
    "public": {
      "type": "boolean"
    },
    "semantic_content": {
      "type": "semantic_text",
      "inference_id": ".elser-2-elasticsearch"
    },
    "summarized_message_ids": {
      "type": "keyword",
      "array": true
    }
  }
}
```

</details>

### New fields description

`semantic_content` field will be used to store conversation summary and
allows semantical search through the ELSER v2 or E5 models.

`summarized_message_ids` field will contain a list of all messages that
are summarized and part of the summary stored within the
`semantic_content` field.

### Legacy fields and API interface changes

There are bunch of fields that were never used and won't be supported or
used in future - `summary.confidence`, `summary.content` and
`summary.public`. After discussion with @YulNaumenko and
@elastic/security-generative-ai, this fields will be marked as legacy on
the mappings level for compatibility with the installed indices and will
be removed on the API level. Previously, we allowed to update
`summary.confidence`, `summary.content` and `summary.public` fields via
API calls and never used in kibana UI.

**NOTE**: Thanks @spong to pointing to [this
cluster](https://overview.elastic-cloud.com/app/dashboards#/view/serverless-api-services-http-requests-overview?_g=h@6558260)
to see the API usage in production. It shows that within last 90 days,
the update conversation API (the only way for users to update
conversations and potentially add a summary to it) was used only 41
times which looks low and I believe negligible.

<img width="1144" height="423" alt="Screenshot 2025-08-20 at 10 50 35"
src="https://github.com/user-attachments/assets/6cb8e1a2-4d9d-44d2-8e66-2de6d8ac74e2"
/>

From now on, the conversation will have next summary fields on the **API
level**:

```typescript
interface ConversationSummary {
  /**
   * The timestamp summary was updated.
   */
  timestamp: string;

  /**
   * Summary text of the conversation over time.
   */
  semanticContent?: string;

  /**
   * The list of summarized messages.
   */
  summarizedMessageIds?: string[];
}
```

### Testing

To test, you can use next API calls:

<details>
  <summary><b>Fetch</b> all existing conversations</summary>
  
This call will fetch all existing conversation. Good for overview of
existing conversations and verifying expected summary values.
```curl
curl --location 'http://localhost:5601/sbb/api/security_ai_assistant/current_user/conversations/_find' \
--header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==' \
--header 'kbn-xsrf: true' \
--header 'elastic-api-version: 2023-10-31'
```

</details>

<details>
  <summary><b>Update</b> a conversation</summary>

This call will update a conversation and add/update a summary.  

```curl
curl --location --request PUT 'http://localhost:5601/sbb/api/security_ai_assistant/current_user/conversations/{{CONVERSATION_ID}}' \
--header 'kbn-xsrf: true' \
--header 'elastic-api-version: 2023-10-31' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==' \
--data '{
    "id": "a565baa8-5566-47b2-ab69-807248b2fc46",
    "summary": {
        "semanticContent": "Very nice demo semantic content."
    }
}'
```

</details>

<details>
  <summary><b>Bulk Update</b> existing conversation(s)</summary>

This call will update a conversation and add/update a summary.  

```curl
curl --location 'http://localhost:5601/sbb/internal/elastic_assistant/current_user/conversations/_bulk_action' \
--header 'kbn-xsrf: true' \
--header 'elastic-api-version: 1' \
--header 'x-elastic-internal-origin: Kibana' \
--header 'kbn-version: 9.2.0' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==' \
--data '{
  "update":
    [
        {
            "id": "{{CONVERSATION_ID}}",
            "summary": {
                "semanticContent": "Very nice demo semantic content."
            }
        }
    ]
}'
```

</details>

Some test cases:
1. Check that if not updated, a new conversation does not have a summary
2. Check that `summary` contains expected value after it has been
updated via one of the above APIs
3. Check that we do not return legacy fields (`summary.confidence`,
`summary.content` and `summary.public`) even if you add a document with
those fields set. You can set legacy fields, either via DevTools or via
update APIs from above in previous kibana version.

---------

Co-authored-by: kibanamachine <[email protected]>
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 232288 locally
cc: @e40pud

@e40pud e40pud added backport:skip This PR does not require backporting and removed backport missing Added to PRs automatically when the are determined to be missing a backport. backport:version Backport to applied version labels labels Sep 1, 2025
jkelas pushed a commit to jkelas/kibana that referenced this pull request Sep 2, 2025
…date (elastic#233288)

## Summary

Part of
Epic: elastic/security-team#12768
Meta: elastic/security-team#13657

In my [previous PR](elastic#232288), I
accidentally removed "retry on conflict"
[logic](https://github.com/elastic/kibana/pull/232288/files#r2305375978).

These changes add a retry logic on bulk update conflicts. For that we
use a `retry_on_conflict` option
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk#operation-bulk-body-application-json-update-retry_on_conflict.
The retry count is set to 3 to match previous behaviour.

cc @stephmilovic
jkelas pushed a commit to jkelas/kibana that referenced this pull request Sep 2, 2025
elastic#233428)

## Summary

Epic: elastic/security-team#12768
Meta: elastic/security-team#13657
RFC: [internal
link](https://docs.google.com/document/d/13jAJ5Q3_At_zAuwKjvpYehnM5uzKJSwZIZ1aJJNAf5k)

This PR reverts conversation mappings changes introduced in
elastic#232288. Since we decided to put
on hold the Using Past Conversation as Context feature, we decided to
remove added summary field backed by the `semantic_text` field to avoid
potential issues that users mights have when updating a conversation
while the inference endpoint is not available.

**Changes**:
* Removed mapping fields: `semantic_content` and
`summarized_message_ids`
* As part of these changes, the `summary` field was hidden on the API
level and conversations response object won't have it anymore

---------

Co-authored-by: kibanamachine <[email protected]>
qn895 pushed a commit to qn895/kibana that referenced this pull request Sep 2, 2025
… and interface (elastic#13657) (elastic#232288)

## Summary

Epic: elastic/security-team#12768
Meta: elastic/security-team#13657
RFC: [internal
link](https://docs.google.com/document/d/13jAJ5Q3_At_zAuwKjvpYehnM5uzKJSwZIZ1aJJNAf5k)

With these changes we update the conversation summary schema to
accommodate new fields to allow conversation summarization and past
conversation search. Also, as part of these changes, the OLD (unused)
summary fields are removed from the APIs.

### Mapping changes

The conversations index mapping already has a `summary` field which is
an object that looks like:

<details>
  <summary><b>OLD</b> summary schema</summary>
  
```json
"summary": {
  "properties": {
    "@timestamp": {
      "type": "date"
    },
    "confidence": {
      "type": "keyword"
    },
    "content": {
      "type": "text"
    },
    "public": {
      "type": "boolean"
    }
  }
}
```

</details>

To be able to summarize conversations and semantically search through
existing summaries, the new fields (`semantic_content` and
`summarized_message_ids`) are added into the mapping:

<details>
  <summary><b>Updated</b> summary schema</summary>
  

```json
"summary": {
  "properties": {
    "@timestamp": {
      "type": "date"
    },
    "confidence": {
      "type": "keyword"
    },
    "content": {
      "type": "text"
    },
    "public": {
      "type": "boolean"
    },
    "semantic_content": {
      "type": "semantic_text",
      "inference_id": ".elser-2-elasticsearch"
    },
    "summarized_message_ids": {
      "type": "keyword",
      "array": true
    }
  }
}
```

</details>

### New fields description

`semantic_content` field will be used to store conversation summary and
allows semantical search through the ELSER v2 or E5 models.

`summarized_message_ids` field will contain a list of all messages that
are summarized and part of the summary stored within the
`semantic_content` field.

### Legacy fields and API interface changes

There are bunch of fields that were never used and won't be supported or
used in future - `summary.confidence`, `summary.content` and
`summary.public`. After discussion with @YulNaumenko and
@elastic/security-generative-ai, this fields will be marked as legacy on
the mappings level for compatibility with the installed indices and will
be removed on the API level. Previously, we allowed to update
`summary.confidence`, `summary.content` and `summary.public` fields via
API calls and never used in kibana UI.

**NOTE**: Thanks @spong to pointing to [this
cluster](https://overview.elastic-cloud.com/app/dashboards#/view/serverless-api-services-http-requests-overview?_g=h@6558260)
to see the API usage in production. It shows that within last 90 days,
the update conversation API (the only way for users to update
conversations and potentially add a summary to it) was used only 41
times which looks low and I believe negligible.

<img width="1144" height="423" alt="Screenshot 2025-08-20 at 10 50 35"
src="https://github.com/user-attachments/assets/6cb8e1a2-4d9d-44d2-8e66-2de6d8ac74e2"
/>

From now on, the conversation will have next summary fields on the **API
level**:

```typescript
interface ConversationSummary {
  /**
   * The timestamp summary was updated.
   */
  timestamp: string;

  /**
   * Summary text of the conversation over time.
   */
  semanticContent?: string;

  /**
   * The list of summarized messages.
   */
  summarizedMessageIds?: string[];
}
```

### Testing

To test, you can use next API calls:

<details>
  <summary><b>Fetch</b> all existing conversations</summary>
  
This call will fetch all existing conversation. Good for overview of
existing conversations and verifying expected summary values.
```curl
curl --location 'http://localhost:5601/sbb/api/security_ai_assistant/current_user/conversations/_find' \
--header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==' \
--header 'kbn-xsrf: true' \
--header 'elastic-api-version: 2023-10-31'
```

</details>

<details>
  <summary><b>Update</b> a conversation</summary>

This call will update a conversation and add/update a summary.  

```curl
curl --location --request PUT 'http://localhost:5601/sbb/api/security_ai_assistant/current_user/conversations/{{CONVERSATION_ID}}' \
--header 'kbn-xsrf: true' \
--header 'elastic-api-version: 2023-10-31' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==' \
--data '{
    "id": "a565baa8-5566-47b2-ab69-807248b2fc46",
    "summary": {
        "semanticContent": "Very nice demo semantic content."
    }
}'
```

</details>

<details>
  <summary><b>Bulk Update</b> existing conversation(s)</summary>

This call will update a conversation and add/update a summary.  

```curl
curl --location 'http://localhost:5601/sbb/internal/elastic_assistant/current_user/conversations/_bulk_action' \
--header 'kbn-xsrf: true' \
--header 'elastic-api-version: 1' \
--header 'x-elastic-internal-origin: Kibana' \
--header 'kbn-version: 9.2.0' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==' \
--data '{
  "update":
    [
        {
            "id": "{{CONVERSATION_ID}}",
            "summary": {
                "semanticContent": "Very nice demo semantic content."
            }
        }
    ]
}'
```

</details>

Some test cases:
1. Check that if not updated, a new conversation does not have a summary
2. Check that `summary` contains expected value after it has been
updated via one of the above APIs
3. Check that we do not return legacy fields (`summary.confidence`,
`summary.content` and `summary.public`) even if you add a document with
those fields set. You can set legacy fields, either via DevTools or via
update APIs from above in previous kibana version.

---------

Co-authored-by: kibanamachine <[email protected]>
e40pud added a commit to e40pud/kibana that referenced this pull request Sep 12, 2025
…date (elastic#233288)

## Summary

Part of
Epic: elastic/security-team#12768
Meta: elastic/security-team#13657

In my [previous PR](elastic#232288), I
accidentally removed "retry on conflict"
[logic](https://github.com/elastic/kibana/pull/232288/files#r2305375978).

These changes add a retry logic on bulk update conflicts. For that we
use a `retry_on_conflict` option
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk#operation-bulk-body-application-json-update-retry_on_conflict.
The retry count is set to 3 to match previous behaviour.

cc @stephmilovic

(cherry picked from commit 8170cff)

# Conflicts:
#	x-pack/solutions/security/plugins/elastic_assistant/server/ai_assistant_data_clients/conversations/index.test.ts
e40pud added a commit to e40pud/kibana that referenced this pull request Sep 12, 2025
…date (elastic#233288)

## Summary

Part of
Epic: elastic/security-team#12768
Meta: elastic/security-team#13657

In my [previous PR](elastic#232288), I
accidentally removed "retry on conflict"
[logic](https://github.com/elastic/kibana/pull/232288/files#r2305375978).

These changes add a retry logic on bulk update conflicts. For that we
use a `retry_on_conflict` option
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk#operation-bulk-body-application-json-update-retry_on_conflict.
The retry count is set to 3 to match previous behaviour.

cc @stephmilovic

(cherry picked from commit 8170cff)

# Conflicts:
#	x-pack/solutions/security/plugins/elastic_assistant/server/ai_assistant_data_clients/conversations/index.test.ts
e40pud added a commit that referenced this pull request Sep 12, 2025
…ulk update (#233288) (#234867)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[Security Solution][AI Assistant] Handle conflicts during the bulk
update (#233288)](#233288)

<!--- Backport version: 10.0.2 -->

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

<!--BACKPORT [{"author":{"name":"Ievgen
Sorokopud","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-08-29T15:04:39Z","message":"[Security
Solution][AI Assistant] Handle conflicts during the bulk update
(#233288)\n\n## Summary\n\nPart of\nEpic:
https://github.com/elastic/security-team/issues/12768\nMeta:
https://github.com/elastic/security-team/issues/13657\n\nIn my [previous
PR](#232288), I\naccidentally
removed \"retry on
conflict\"\n[logic](https://github.com/elastic/kibana/pull/232288/files#r2305375978).\n\nThese
changes add a retry logic on bulk update conflicts. For that we\nuse a
`retry_on_conflict`
option\nhttps://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk#operation-bulk-body-application-json-update-retry_on_conflict.\nThe
retry count is set to 3 to match previous behaviour.\n\ncc
@stephmilovic","sha":"8170cff4f95f5dad24f3d40f0b2a84ab083af93e","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:skip","Team:
SecuritySolution","Team:Security Generative
AI","v9.2.0"],"title":"[Security Solution][AI Assistant] Handle
conflicts during the bulk
update","number":233288,"url":"https://github.com/elastic/kibana/pull/233288","mergeCommit":{"message":"[Security
Solution][AI Assistant] Handle conflicts during the bulk update
(#233288)\n\n## Summary\n\nPart of\nEpic:
https://github.com/elastic/security-team/issues/12768\nMeta:
https://github.com/elastic/security-team/issues/13657\n\nIn my [previous
PR](#232288), I\naccidentally
removed \"retry on
conflict\"\n[logic](https://github.com/elastic/kibana/pull/232288/files#r2305375978).\n\nThese
changes add a retry logic on bulk update conflicts. For that we\nuse a
`retry_on_conflict`
option\nhttps://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk#operation-bulk-body-application-json-update-retry_on_conflict.\nThe
retry count is set to 3 to match previous behaviour.\n\ncc
@stephmilovic","sha":"8170cff4f95f5dad24f3d40f0b2a84ab083af93e"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/233288","number":233288,"mergeCommit":{"message":"[Security
Solution][AI Assistant] Handle conflicts during the bulk update
(#233288)\n\n## Summary\n\nPart of\nEpic:
https://github.com/elastic/security-team/issues/12768\nMeta:
https://github.com/elastic/security-team/issues/13657\n\nIn my [previous
PR](#232288), I\naccidentally
removed \"retry on
conflict\"\n[logic](https://github.com/elastic/kibana/pull/232288/files#r2305375978).\n\nThese
changes add a retry logic on bulk update conflicts. For that we\nuse a
`retry_on_conflict`
option\nhttps://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk#operation-bulk-body-application-json-update-retry_on_conflict.\nThe
retry count is set to 3 to match previous behaviour.\n\ncc
@stephmilovic","sha":"8170cff4f95f5dad24f3d40f0b2a84ab083af93e"}}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <[email protected]>
e40pud added a commit that referenced this pull request Sep 12, 2025
…bulk update (#233288) (#234869)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[Security Solution][AI Assistant] Handle conflicts during the bulk
update (#233288)](#233288)

<!--- Backport version: 10.0.2 -->

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

<!--BACKPORT [{"author":{"name":"Ievgen
Sorokopud","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-08-29T15:04:39Z","message":"[Security
Solution][AI Assistant] Handle conflicts during the bulk update
(#233288)\n\n## Summary\n\nPart of\nEpic:
https://github.com/elastic/security-team/issues/12768\nMeta:
https://github.com/elastic/security-team/issues/13657\n\nIn my [previous
PR](#232288), I\naccidentally
removed \"retry on
conflict\"\n[logic](https://github.com/elastic/kibana/pull/232288/files#r2305375978).\n\nThese
changes add a retry logic on bulk update conflicts. For that we\nuse a
`retry_on_conflict`
option\nhttps://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk#operation-bulk-body-application-json-update-retry_on_conflict.\nThe
retry count is set to 3 to match previous behaviour.\n\ncc
@stephmilovic","sha":"8170cff4f95f5dad24f3d40f0b2a84ab083af93e","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:skip","Team:
SecuritySolution","Team:Security Generative
AI","v9.2.0"],"title":"[Security Solution][AI Assistant] Handle
conflicts during the bulk
update","number":233288,"url":"https://github.com/elastic/kibana/pull/233288","mergeCommit":{"message":"[Security
Solution][AI Assistant] Handle conflicts during the bulk update
(#233288)\n\n## Summary\n\nPart of\nEpic:
https://github.com/elastic/security-team/issues/12768\nMeta:
https://github.com/elastic/security-team/issues/13657\n\nIn my [previous
PR](#232288), I\naccidentally
removed \"retry on
conflict\"\n[logic](https://github.com/elastic/kibana/pull/232288/files#r2305375978).\n\nThese
changes add a retry logic on bulk update conflicts. For that we\nuse a
`retry_on_conflict`
option\nhttps://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk#operation-bulk-body-application-json-update-retry_on_conflict.\nThe
retry count is set to 3 to match previous behaviour.\n\ncc
@stephmilovic","sha":"8170cff4f95f5dad24f3d40f0b2a84ab083af93e"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/233288","number":233288,"mergeCommit":{"message":"[Security
Solution][AI Assistant] Handle conflicts during the bulk update
(#233288)\n\n## Summary\n\nPart of\nEpic:
https://github.com/elastic/security-team/issues/12768\nMeta:
https://github.com/elastic/security-team/issues/13657\n\nIn my [previous
PR](#232288), I\naccidentally
removed \"retry on
conflict\"\n[logic](https://github.com/elastic/kibana/pull/232288/files#r2305375978).\n\nThese
changes add a retry logic on bulk update conflicts. For that we\nuse a
`retry_on_conflict`
option\nhttps://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk#operation-bulk-body-application-json-update-retry_on_conflict.\nThe
retry count is set to 3 to match previous behaviour.\n\ncc
@stephmilovic","sha":"8170cff4f95f5dad24f3d40f0b2a84ab083af93e"}}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Security Assistant Security Assistant release_note:skip Skip the PR/issue when compiling release notes Team:Security Generative AI Security Generative AI Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants