You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2026/09/22 07:13:00 UTC

[jira] [Resolved] (CAMEL-24814) camel-elasticsearch/camel-opensearch: BulkRequestAggregationStrategy returns the wrong exchange, breaking bulk aggregation

     [ https://issues.apache.org/jira/browse/CAMEL-24814?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-24814.
---------------------------------
    Resolution: Fixed

> camel-elasticsearch/camel-opensearch: BulkRequestAggregationStrategy returns the wrong exchange, breaking bulk aggregation
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-24814
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24814
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-elasticsearch, camel-opensearch
>            Reporter: Andrea Cosentino
>            Assignee: Andrea Cosentino
>            Priority: Major
>             Fix For: 4.23.0
>
>
> *ElasticsearchBulkRequestAggregationStrategy* and its OpenSearch twin *OpensearchBulkRequestAggregationStrategy* implement Camel's AggregationStrategy to merge multiple {{BulkOperation\[\]}} messages into a single {{BulkRequest}} (the documented bulk-aggregation pattern). Both build the merged request and store it on *newExchange* via {{newExchange.getIn().setBody(builder.build())}}, but then {{return oldExchange;}}.
> On the first message of any aggregation group {{oldExchange == null}}, so the strategy returns {{null}}. Camel's {{AggregateProcessor}} rejects a null return (see AggregateProcessor: _"AggregationStrategy ... returned null which is not allowed"_), so the very first exchange in every group fails with a CamelExchangeException. Even past the first call, the returned exchange never carries the merged {{BulkRequest}} that was placed on {{newExchange}}. The strategy is therefore non-functional for its only purpose.
> The bug is latent because neither component has a unit test exercising the strategy.
> *Fix:* return {{newExchange}} (which already holds the merged BulkRequest) in both classes, and add a unit test covering the first-call and subsequent-call paths in each component.
> Affects camel-elasticsearch and camel-opensearch equally.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)