Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter aggregation fails with index_out_of_bounds_exception when nested within rare_terms #51020

Closed
fkelbert opened this issue Jan 15, 2020 · 6 comments · Fixed by #51868
Closed
Assignees

Comments

@fkelbert
Copy link

fkelbert commented Jan 15, 2020

Elasticsearch version (bin/elasticsearch --version): 7.5 on Elastic Cloud

Description of the problem including expected versus actual behavior:

I am nesting a filter aggregation within a rare_terms aggregation:

GET metricbeat-7.5.1-2019.12.26-000001/_search
{
  "size": 0,
  "aggs": {
    "rare": {
      "rare_terms": {
        "field": "process.name",
        "max_doc_count": 3
      },
      "aggs": {
        "filter": {
          "filter": {
            "range": {
              "@timestamp": {
                "gte": "now-15m"
              }
            }
          }
        }
      }
    }
  }
}

Some (or all) shards fail, returning an index_out_of_bounds_exception.

{
  "error": {
    "root_cause": [
      {
        "type": "index_out_of_bounds_exception",
        "reason": "index_out_of_bounds_exception: -1429505 is out of bounds: [0-1452587["
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "metricbeat-7.5.1-2019.12.26-000001",
        "node": "NKmctNiHRTmKb2eNEhREIg",
        "reason": {
          "type": "index_out_of_bounds_exception",
          "reason": "index_out_of_bounds_exception: -1429505 is out of bounds: [0-1452587["
        }
      }
    ]
  },
  "status": 500
}

Playing with the range query, it turns our that this works for some values of gte, and not for others.
In my case, the query above (currently) works for, e.g., "gte": "2020-01-14T00:00:00".

I am on Elastic Cloud and was unable to find additional logs. Please let me know which other information you need and how I can obtain it.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (:Analytics/Aggregations)

@fkelbert
Copy link
Author

fkelbert commented Jan 15, 2020

This will also happen with the following query, where field user_source is a concatenation of username and source IP address:

GET winlogbeat-7.4-2020.01.15/_search
{
  "size": 0,
  "aggs": {
    "asd": {
      "rare_terms": {
        "max_doc_count": "3",
        "field": "user_source"
      },
      "aggs": {
        "NAME": {
          "top_hits": {
            "size": 1,
            "_source": ["@timestamp"],
            "sort": [{"@timestamp": {
              "order": "asc"
            }}]
          }
        }
      }
    }
  }
}

@nik9000 nik9000 self-assigned this Jan 15, 2020
@polyfractal
Copy link
Contributor

I haven't looked at code yet or reproduced this particular error, but there's definitely something funky going on with sub-aggregators and max_doc_count. E.g. without a sub-agg, rare and terms agree on counts:

GET /test/_search
{
  "size": 0,
  "aggs": {
    "terms": {
      "terms": {
        "field": "host",
        "size": 10
      }
    },
    "rare": {
      "rare_terms": {
        "field": "host",
        "max_doc_count": 10,
        "precision": 0.00001
      }
    }
  }
}
{
  "aggregations" : {
    "terms" : {
      "doc_count_error_upper_bound" : 0,
      "sum_other_doc_count" : 0,
      "buckets" : [
        {
          "key" : "a",
          "doc_count" : 3
        },
        {
          "key" : "c",
          "doc_count" : 2
        },
        {
          "key" : "b",
          "doc_count" : 1
        }
      ]
    },
    "rare" : {
      "buckets" : [
        {
          "key" : "b",
          "doc_count" : 1
        },
        {
          "key" : "c",
          "doc_count" : 2
        },
        {
          "key" : "a",
          "doc_count" : 3
        }
      ]
    }
  }
}

But adding that filter sub-agg makes the rare_terms results incorrect, no matter how you play with precision or max_doc_count:

GET /test/_search
{
  "size": 0,
  "aggs": {
    "terms": {
      "terms": {
        "field": "host",
        "size": 10
      }
    },
    "rare": {
      "rare_terms": {
        "field": "host",
        "max_doc_count": 10,
        "precision": 0.00001
      },
      "aggs": {
        "filter": {
          "filter": {
            "range": {
              "@date": {
                "gte": "now-15m"
              }
            }
          }
        }
      }
    }
  }
}
{
  "aggregations" : {
    "terms" : {
      "doc_count_error_upper_bound" : 0,
      "sum_other_doc_count" : 0,
      "buckets" : [
        {
          "key" : "a",
          "doc_count" : 3
        },
        {
          "key" : "c",
          "doc_count" : 2
        },
        {
          "key" : "b",
          "doc_count" : 1
        }
      ]
    },
    "rare" : {
      "meta" : { },
      "buckets" : [
        {
          "key" : "b",
          "doc_count" : 1,
          "filter" : {
            "meta" : { },
            "doc_count" : 0
          }
        }
      ]
    }
  }
}

(Note: none of the docs in my test actually match now-15m either).

Not sure what's going on, but rare_terms is a deferring aggregator that merges buckets, so I'm guessing there's something incorrect happening with the deferred execution and replaying docs into sub-aggs.

@nik9000
Copy link
Member

nik9000 commented Jan 17, 2020

I can't reproduce the failure locally. Is there any chance you could either build a complete reproduction against an empty cluster or attach a stack trace?

@fkelbert
Copy link
Author

Hi @nik9000. I hope this stack trace helps:

{
  "error": {
    "root_cause": [
      {
        "type": "index_out_of_bounds_exception",
        "reason": "index_out_of_bounds_exception: -1400720 is out of bounds: [0-1452587[",
        "stack_trace": "NotSerializableExceptionWrapper[index_out_of_bounds_exception: -1400720 is out of bounds: [0-1452587[]\n\tat org.elasticsearch.common.lucene.Lucene$2.get(Lucene.java:856)\n\tat org.elasticsearch.search.aggregations.bucket.filter.FilterAggregator$1.collect(FilterAggregator.java:65)\n\tat org.elasticsearch.search.aggregations.bucket.BestBucketsDeferringCollector.prepareSelectedBuckets(BestBucketsDeferringCollector.java:197)\n\tat org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector.replay(DeferringBucketCollector.java:45)\n\tat org.elasticsearch.search.aggregations.bucket.DeferableBucketAggregator.runDeferredCollections(DeferableBucketAggregator.java:103)\n\tat org.elasticsearch.search.aggregations.bucket.terms.StringRareTermsAggregator.buildAggregation(StringRareTermsAggregator.java:154)\n\tat org.elasticsearch.search.aggregations.AggregationPhase.execute(AggregationPhase.java:130)\n\tat org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:119)\n\tat org.elasticsearch.indices.IndicesService.lambda$loadIntoContext$18(IndicesService.java:1290)\n\tat org.elasticsearch.indices.IndicesService.lambda$cacheShardLevelResult$19(IndicesService.java:1347)\n\tat org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:174)\n\tat org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:157)\n\tat org.elasticsearch.common.cache.Cache.computeIfAbsent(Cache.java:433)\n\tat org.elasticsearch.indices.IndicesRequestCache.getOrCompute(IndicesRequestCache.java:123)\n\tat org.elasticsearch.indices.IndicesService.cacheShardLevelResult(IndicesService.java:1353)\n\tat org.elasticsearch.indices.IndicesService.loadIntoContext(IndicesService.java:1287)\n\tat org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:333)\n\tat org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:355)\n\tat org.elasticsearch.search.SearchService.lambda$executeQueryPhase$1(SearchService.java:340)\n\tat org.elasticsearch.action.ActionListener.lambda$map$2(ActionListener.java:146)\n\tat org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:63)\n\tat org.elasticsearch.action.ActionRunnable.lambda$supply$0(ActionRunnable.java:58)\n\tat org.elasticsearch.action.ActionRunnable$2.doRun(ActionRunnable.java:73)\n\tat org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)\n\tat org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:44)\n\tat org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:773)\n\tat org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.lang.Thread.run(Thread.java:830)\n"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "metricbeat-7.5.1-2019.12.26-000001",
        "node": "Vdl9uO-ITFSLfQJ1akqQmw",
        "reason": {
          "type": "index_out_of_bounds_exception",
          "reason": "index_out_of_bounds_exception: -1400720 is out of bounds: [0-1452587[",
          "stack_trace": "NotSerializableExceptionWrapper[index_out_of_bounds_exception: -1400720 is out of bounds: [0-1452587[]\n\tat org.elasticsearch.common.lucene.Lucene$2.get(Lucene.java:856)\n\tat org.elasticsearch.search.aggregations.bucket.filter.FilterAggregator$1.collect(FilterAggregator.java:65)\n\tat org.elasticsearch.search.aggregations.bucket.BestBucketsDeferringCollector.prepareSelectedBuckets(BestBucketsDeferringCollector.java:197)\n\tat org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector.replay(DeferringBucketCollector.java:45)\n\tat org.elasticsearch.search.aggregations.bucket.DeferableBucketAggregator.runDeferredCollections(DeferableBucketAggregator.java:103)\n\tat org.elasticsearch.search.aggregations.bucket.terms.StringRareTermsAggregator.buildAggregation(StringRareTermsAggregator.java:154)\n\tat org.elasticsearch.search.aggregations.AggregationPhase.execute(AggregationPhase.java:130)\n\tat org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:119)\n\tat org.elasticsearch.indices.IndicesService.lambda$loadIntoContext$18(IndicesService.java:1290)\n\tat org.elasticsearch.indices.IndicesService.lambda$cacheShardLevelResult$19(IndicesService.java:1347)\n\tat org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:174)\n\tat org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:157)\n\tat org.elasticsearch.common.cache.Cache.computeIfAbsent(Cache.java:433)\n\tat org.elasticsearch.indices.IndicesRequestCache.getOrCompute(IndicesRequestCache.java:123)\n\tat org.elasticsearch.indices.IndicesService.cacheShardLevelResult(IndicesService.java:1353)\n\tat org.elasticsearch.indices.IndicesService.loadIntoContext(IndicesService.java:1287)\n\tat org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:333)\n\tat org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:355)\n\tat org.elasticsearch.search.SearchService.lambda$executeQueryPhase$1(SearchService.java:340)\n\tat org.elasticsearch.action.ActionListener.lambda$map$2(ActionListener.java:146)\n\tat org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:63)\n\tat org.elasticsearch.action.ActionRunnable.lambda$supply$0(ActionRunnable.java:58)\n\tat org.elasticsearch.action.ActionRunnable$2.doRun(ActionRunnable.java:73)\n\tat org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)\n\tat org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:44)\n\tat org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:773)\n\tat org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.lang.Thread.run(Thread.java:830)\n"
        }
      }
    ],
    "stack_trace": "Failed to execute phase [query], all shards failed; shardFailures {[Vdl9uO-ITFSLfQJ1akqQmw][metricbeat-7.5.1-2019.12.26-000001][0]: RemoteTransportException[[instance-0000000012][172.17.0.13:19701][indices:data/read/search[phase/query]]]; nested: NotSerializableExceptionWrapper[index_out_of_bounds_exception: -1400720 is out of bounds: [0-1452587[]; }\n\tat org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseFailure(AbstractSearchAsyncAction.java:534)\n\tat org.elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:305)\n\tat org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseDone(AbstractSearchAsyncAction.java:563)\n\tat org.elasticsearch.action.search.AbstractSearchAsyncAction.onShardFailure(AbstractSearchAsyncAction.java:384)\n\tat org.elasticsearch.action.search.AbstractSearchAsyncAction.access$200(AbstractSearchAsyncAction.java:65)\n\tat org.elasticsearch.action.search.AbstractSearchAsyncAction$1.onFailure(AbstractSearchAsyncAction.java:241)\n\tat org.elasticsearch.action.search.SearchExecutionStatsCollector.onFailure(SearchExecutionStatsCollector.java:73)\n\tat org.elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:59)\n\tat org.elasticsearch.action.search.SearchTransportService$ConnectionCountingHandler.handleException(SearchTransportService.java:423)\n\tat org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:1120)\n\tat org.elasticsearch.transport.InboundHandler.lambda$handleException$2(InboundHandler.java:243)\n\tat org.elasticsearch.common.util.concurrent.EsExecutors$DirectExecutorService.execute(EsExecutors.java:225)\n\tat org.elasticsearch.transport.InboundHandler.handleException(InboundHandler.java:241)\n\tat org.elasticsearch.transport.InboundHandler.handlerResponseError(InboundHandler.java:233)\n\tat org.elasticsearch.transport.InboundHandler.messageReceived(InboundHandler.java:136)\n\tat org.elasticsearch.transport.InboundHandler.inboundMessage(InboundHandler.java:102)\n\tat org.elasticsearch.transport.TcpTransport.inboundMessage(TcpTransport.java:667)\n\tat org.elasticsearch.transport.netty4.Netty4MessageChannelHandler.channelRead(Netty4MessageChannelHandler.java:62)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)\n\tat io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:326)\n\tat io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:300)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)\n\tat io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:241)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)\n\tat io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1478)\n\tat io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1227)\n\tat io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1274)\n\tat io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:503)\n\tat io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:442)\n\tat io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:281)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)\n\tat io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1422)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)\n\tat io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:931)\n\tat io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:700)\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:600)\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:554)\n\tat io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:514)\n\tat io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1050)\n\tat io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)\n\tat java.base/java.lang.Thread.run(Thread.java:830)\nCaused by: NotSerializableExceptionWrapper[index_out_of_bounds_exception: -1400720 is out of bounds: [0-1452587[]\n\tat org.elasticsearch.common.lucene.Lucene$2.get(Lucene.java:856)\n\tat org.elasticsearch.search.aggregations.bucket.filter.FilterAggregator$1.collect(FilterAggregator.java:65)\n\tat org.elasticsearch.search.aggregations.bucket.BestBucketsDeferringCollector.prepareSelectedBuckets(BestBucketsDeferringCollector.java:197)\n\tat org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector.replay(DeferringBucketCollector.java:45)\n\tat org.elasticsearch.search.aggregations.bucket.DeferableBucketAggregator.runDeferredCollections(DeferableBucketAggregator.java:103)\n\tat org.elasticsearch.search.aggregations.bucket.terms.StringRareTermsAggregator.buildAggregation(StringRareTermsAggregator.java:154)\n\tat org.elasticsearch.search.aggregations.AggregationPhase.execute(AggregationPhase.java:130)\n\tat org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:119)\n\tat org.elasticsearch.indices.IndicesService.lambda$loadIntoContext$18(IndicesService.java:1290)\n\tat org.elasticsearch.indices.IndicesService.lambda$cacheShardLevelResult$19(IndicesService.java:1347)\n\tat org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:174)\n\tat org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:157)\n\tat org.elasticsearch.common.cache.Cache.computeIfAbsent(Cache.java:433)\n\tat org.elasticsearch.indices.IndicesRequestCache.getOrCompute(IndicesRequestCache.java:123)\n\tat org.elasticsearch.indices.IndicesService.cacheShardLevelResult(IndicesService.java:1353)\n\tat org.elasticsearch.indices.IndicesService.loadIntoContext(IndicesService.java:1287)\n\tat org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:333)\n\tat org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:355)\n\tat org.elasticsearch.search.SearchService.lambda$executeQueryPhase$1(SearchService.java:340)\n\tat org.elasticsearch.action.ActionListener.lambda$map$2(ActionListener.java:146)\n\tat org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:63)\n\tat org.elasticsearch.action.ActionRunnable.lambda$supply$0(ActionRunnable.java:58)\n\tat org.elasticsearch.action.ActionRunnable$2.doRun(ActionRunnable.java:73)\n\tat org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)\n\tat org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:44)\n\tat org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:773)\n\tat org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.lang.Thread.run(Thread.java:830)\n"
  },
  "status": 500
}

@nik9000
Copy link
Member

nik9000 commented Feb 3, 2020

I've reproduced this locally - something is indeed wrong with the merging, I believe.

nik9000 added a commit to nik9000/elasticsearch that referenced this issue Feb 4, 2020
When the `rare_terms` aggregation contained another aggregation it'd
break them. Most of the time. This happened because the process that it
uses to remove buckets that turn out not to be rare was incorrectly
merging results from multiple leaves. This'd cause array index out of
bounds issues. We didn't catch it in the test because the issue doesn't
happen on the very first bucket. And the tests generated data in such a
way that the first bucket always contained the rare terms. Randomizing
the order of the generated data fixed the test so it caught the issue.

Closes elastic#51020
nik9000 added a commit that referenced this issue Feb 5, 2020
When the `rare_terms` aggregation contained another aggregation it'd
break them. Most of the time. This happened because the process that it
uses to remove buckets that turn out not to be rare was incorrectly
merging results from multiple leaves. This'd cause array index out of
bounds issues. We didn't catch it in the test because the issue doesn't
happen on the very first bucket. And the tests generated data in such a
way that the first bucket always contained the rare terms. Randomizing
the order of the generated data fixed the test so it caught the issue.

Closes #51020
nik9000 added a commit to nik9000/elasticsearch that referenced this issue Feb 5, 2020
When the `rare_terms` aggregation contained another aggregation it'd
break them. Most of the time. This happened because the process that it
uses to remove buckets that turn out not to be rare was incorrectly
merging results from multiple leaves. This'd cause array index out of
bounds issues. We didn't catch it in the test because the issue doesn't
happen on the very first bucket. And the tests generated data in such a
way that the first bucket always contained the rare terms. Randomizing
the order of the generated data fixed the test so it caught the issue.

Closes elastic#51020
nik9000 added a commit to nik9000/elasticsearch that referenced this issue Feb 5, 2020
When the `rare_terms` aggregation contained another aggregation it'd
break them. Most of the time. This happened because the process that it
uses to remove buckets that turn out not to be rare was incorrectly
merging results from multiple leaves. This'd cause array index out of
bounds issues. We didn't catch it in the test because the issue doesn't
happen on the very first bucket. And the tests generated data in such a
way that the first bucket always contained the rare terms. Randomizing
the order of the generated data fixed the test so it caught the issue.

Closes elastic#51020
nik9000 added a commit that referenced this issue Feb 5, 2020
When the `rare_terms` aggregation contained another aggregation it'd
break them. Most of the time. This happened because the process that it
uses to remove buckets that turn out not to be rare was incorrectly
merging results from multiple leaves. This'd cause array index out of
bounds issues. We didn't catch it in the test because the issue doesn't
happen on the very first bucket. And the tests generated data in such a
way that the first bucket always contained the rare terms. Randomizing
the order of the generated data fixed the test so it caught the issue.

Closes #51020
nik9000 added a commit that referenced this issue Feb 12, 2020
When the `rare_terms` aggregation contained another aggregation it'd
break them. Most of the time. This happened because the process that it
uses to remove buckets that turn out not to be rare was incorrectly
merging results from multiple leaves. This'd cause array index out of
bounds issues. We didn't catch it in the test because the issue doesn't
happen on the very first bucket. And the tests generated data in such a
way that the first bucket always contained the rare terms. Randomizing
the order of the generated data fixed the test so it caught the issue.

Closes #51020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants