Skip to content

CCS: sibling pipeline aggregations don't work when minimizing roundtrips #40059

@chrisronline

Description

@chrisronline

Elasticsearch version (bin/elasticsearch --version): latest master snapshot (hash: 8839a72)

Plugins installed: []

JVM version (java -version): java version "11.0.1" 2018-10-16 LTS

OS version (uname -a if on a Unix-like system): Darwin Kernel Version 18.2.0

Description of the problem including expected versus actual behavior:

When performing a CCS search request, an error occurs if there is a pipeline aggregation in the query.

The exact error is:

   │      java.lang.UnsupportedOperationException: Not supported
   │      	at org.elasticsearch.search.aggregations.pipeline.InternalSimpleValue.doReduce(InternalSimpleValue.java:80) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
   │      	at org.elasticsearch.search.aggregations.pipeline.InternalSimpleValue.doReduce(InternalSimpleValue.java:34) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
   │      	at org.elasticsearch.search.aggregations.InternalAggregation.reduce(InternalAggregation.java:135) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
   │      	at org.elasticsearch.search.aggregations.InternalAggregations.reduce(InternalAggregations.java:90) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
   │      	at org.elasticsearch.action.search.SearchResponseMerger.getMergedResponse(SearchResponseMerger.java:193) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
   │      	at org.elasticsearch.action.search.TransportSearchAction$3.createFinalResponse(TransportSearchAction.java:389) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
   │      	at org.elasticsearch.action.search.TransportSearchAction$3.createFinalResponse(TransportSearchAction.java:379) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]

Steps to reproduce:

  1. Start two ES instances, ensuring they have unique cluster.names
  2. Bulk index documents into both:
POST _bulk
{ "index": { "_index": "sales" } }
{ "price": 10, "payment_type": "credit_card" }
{ "index": { "_index": "sales" } }
{ "price": 20, "payment_type": "cash" }
  1. Configure one ES instance to talk to the other through CCS
POST _cluster/settings
{
  "persistent": {
    "cluster": {
      "remote": {
        "other": {
          "seeds": [
            "{other_es_instance_address}"
          ]
        }
      }
    }
  }
}
  1. Perform a CCS search that uses a pipeline aggregations from the same ES instance
POST *:sales,sales/_search
{
  "size": 0,
  "aggs": {
    "sales_per_type": {
      "terms": {
        "field": "payment_type.keyword"
      },
      "aggs": {
        "sales": {
          "sum": {
            "field": "price"
          }
        }
      }
    },
    "max_per_type": {
      "max_bucket": {
        "buckets_path": "sales_per_type>sales"
      }
    }
  }
}

It's worth noting that the same query does not incur an error when used in either of these contexts:
POST sales/_search
POST *:sales/_search

The error only occurs when doing them together: POST *:sales,sales/_search.

It's also worth noting that the query does not incur an error when you remove the pipeline aggregation:

POST *:sales,sales/_search
{
  "size": 0,
  "aggs": {
    "sales_per_type": {
      "terms": {
        "field": "payment_type.keyword"
      },
      "aggs": {
        "sales": {
          "sum": {
            "field": "price"
          }
        }
      }
    }
  }
}

This is currently BREAKING the Kibana Stack Monitoring app, as we run these sorts of pipeline aggregations which are currently broken with CCS enabled.

The work done in this PR might be related to this, as the description seems like it touches the code around this

Metadata

Metadata

Assignees

Labels

:Search/SearchSearch-related issues that do not fall into other categories>bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions