Git Product home page Git Product logo

Comments (6)

elasticsearchmachine avatar elasticsearchmachine commented on July 20, 2024

Pinging @elastic/ml-core (Team:ML)

from elasticsearch.

elasticsearchmachine avatar elasticsearchmachine commented on July 20, 2024

Pinging @elastic/es-analytical-engine (Team:Analytics)

from elasticsearch.

benwtrent avatar benwtrent commented on July 20, 2024

@dgieselaar is the original finder of this bug.

@dgieselaar it doesn't seem like the request has random_sampler in it at all? Is this all about categorize_text with a top_hits sub aggregation?

from elasticsearch.

dgieselaar avatar dgieselaar commented on July 20, 2024

@benwtrent no, my head is a mess today. copied the wrong request. Here is the right one:

GET logs-foo-default*/_search?error_trace=true
{
  "track_total_hits": false,
  "size": 0,
  "query": {
    "bool": {
      "filter": [
        {
          "range": {
            "@timestamp": {
              "gte": "now-24h"
            }
          }
        }
      ]
    }
  },
  "aggs": {
    "sampler": {
      "random_sampler": {
        "probability": 1
      },
      "aggs": {
        "samples": {
          "top_hits": {
            "size": 3,
            "_source": [
              "message"
            ]
          }
        }
      }
    }
  }
}

from elasticsearch.

benwtrent avatar benwtrent commented on July 20, 2024

Thank you @dgieselaar ! I was able to replicate. It is repeatable with some very simple text data.

POST test_text/_search
{
  "aggs": {
    "random_sampler": {
      "random_sampler": {
        "probability": 0.5
      },
      "aggs": {
        "samples": {
          "top_hits": {
            "size": 1,
            "_source": [
              "text"
            ]
          }
        }
      }
    }
  }
}
Caused by: java.lang.NullPointerException: Cannot invoke "org.apache.lucene.search.Scorable.score()" because "this.scorer" is null
	at [email protected]/org.apache.lucene.search.TopScoreDocCollector$SimpleTopScoreDocCollector$1.collect(TopScoreDocCollector.java:72)
	at [email protected]/org.elasticsearch.search.aggregations.metrics.TopHitsAggregator$1.collect(TopHitsAggregator.java:159)
	at [email protected]/org.elasticsearch.search.aggregations.bucket.BucketsAggregator.collectExistingBucket(BucketsAggregator.java:97)
	at [email protected]/org.elasticsearch.search.aggregations.bucket.BucketsAggregator.collectBucket(BucketsAggregator.java:81)
	at [email protected]/org.elasticsearch.search.aggregations.bucket.sampler.random.RandomSamplerAggregator.getLeafCollector(RandomSamplerAggregator.java:120)
	at [email protected]/org.elasticsearch.search.aggregations.AggregatorBase.getLeafCollector(AggregatorBase.java:222)
	at [email protected]/org.elasticsearch.search.aggregations.MultiBucketCollector$1.getLeafCollector(MultiBucketCollector.java:92)
	at [email protected]/org.elasticsearch.search.aggregations.AggregatorCollector.getLeafCollector(AggregatorCollector.java:35)
	at [email protected]/org.elasticsearch.search.query.QueryPhaseCollector.getLeafCollector(QueryPhaseCollector.java:165)
	at [email protected]/org.elasticsearch.search.internal.ContextIndexSearcher.searchLeaf(ContextIndexSearcher.java:415)
	at [email protected]/org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:360)
	at [email protected]/org.elasticsearch.search.internal.ContextIndexSearcher.lambda$search$4(ContextIndexSearcher.java:345)
	at [email protected]/org.apache.lucene.search.TaskExecutor$TaskGroup.lambda$createTask$0(TaskExecutor.java:117)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)

from elasticsearch.

benwtrent avatar benwtrent commented on July 20, 2024

There are two causes here:

One, with probility is 1.0 we return a collector that doesn't accept setting the scorer.

        if (probability >= 1.0) {
            grow(1);
            return new LeafBucketCollector() {
                @Override
                public void collect(int doc, long owningBucketOrd) throws IOException {
                    collectExistingBucket(sub, doc, 0);
                }
            };
        }

So, that needs to accept scorable and pass it to the sub.

But for collectExistingBucket, we need the scorable there and I am not sure its possible.

                    "stack_trace": "java.lang.NullPointerException: Cannot invoke \"org.apache.lucene.search.Scorable.score()\" because \"this.scorer\" is null
\tat [email protected]/org.apache.lucene.search.TopScoreDocCollector$SimpleTopScoreDocCollector$1.collect(TopScoreDocCollector.java:72)
\tat [email protected]/org.elasticsearch.search.aggregations.metrics.TopHitsAggregator$1.collect(TopHitsAggregator.java:158)
\tat [email protected]/org.elasticsearch.search.aggregations.bucket.BucketsAggregator.collectExistingBucket(BucketsAggregator.java:98)
\tat [email protected]/org.elasticsearch.search.aggregations.bucket.sampler.random.RandomSamplerAggregator.getLeafCollector(RandomSamplerAggregator.java:132)
\tat [email protected]/org.elasticsearch.search.aggregations.AggregatorBase.getLeafCollector(AggregatorBase.java:222)
\tat [email protected]/org.elasticsearch.search.aggregations.MultiBucketCollector$1.getLeafCollector(MultiBucketCollector.java:92)
\tat [email protected]/org.elasticsearch.search.aggregations.AggregatorCollector.getLeafCollector(AggregatorCollector.java:35)
\tat [email protected]/org.elasticsearch.search.query.QueryPhaseCollector.getLeafCollector(QueryPhaseCollector.java:165)
\tat [email protected]/org.elasticsearch.search.internal.ContextIndexSearcher.searchLeaf(ContextIndexSearcher.java:420)
\tat [email protected]/org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:365)
\tat [email protected]/org.elasticsearch.search.internal.ContextIndexSearcher.lambda$search$3(ContextIndexSearcher.java:350)
\tat [email protected]/org.apache.lucene.search.TaskExecutor$TaskGroup.lambda$createTask$0(TaskExecutor.java:117)
\tat java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
\tat [email protected]/org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)
\tat [email protected]/org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:984)
\tat [email protected]/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
\tat java.base/java.lang.Thread.run(Thread.java:1570)
"

from elasticsearch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.