elasticsearch/test
Nik Everett 128144dd6d
ESQL: Add documents_found and values_loaded (#125631)
This adds `documents_found` and `values_loaded` to the to the ESQL response:
```json
{
  "took" : 194,
  "is_partial" : false,
  "documents_found" : 100000,
  "values_loaded" : 200000,
  "columns" : [
    { "name" : "a", "type" : "long" },
    { "name" : "b", "type" : "long" }
  ],
  "values" : [[10, 1]]
}
```

These are cheap enough to collect that we can do it for every query and
return it with every response. It's small, but it still gives you a
reasonable sense of how much work Elasticsearch had to go through to
perform the query.

I've also added these two fields to the driver profile and task status:
```json
    "drivers" : [
      {
        "description" : "data",
        "cluster_name" : "runTask",
        "node_name" : "runTask-0",
        "start_millis" : 1742923173077,
        "stop_millis" : 1742923173087,
        "took_nanos" : 9557014,
        "cpu_nanos" : 9091340,
        "documents_found" : 5,   <---- THESE
        "values_loaded" : 15,    <---- THESE
        "iterations" : 6,
...
```

These are at a high level and should be easy to reason about. We'd like to
extract this into a "show me how difficult this running query is" API one
day. But today, just plumbing it into the debugging output is good.

Any `Operator` can claim to "find documents" or "load values" by overriding
a method on its `Operator.Status` implementation:
```java
/**
 * The number of documents found by this operator. Most operators
 * don't find documents and will return {@code 0} here.
 */
default long documentsFound() {
    return 0;
}

/**
 * The number of values loaded by this operator. Most operators
 * don't load values and will return {@code 0} here.
 */
default long valuesLoaded() {
    return 0;
}
```

In this PR all of the `LuceneOperator`s declare that each `position` they
emit is a "document found" and the `ValuesSourceValuesSourceReaderOperator`
says each value it makes is a "value loaded". That's pretty pretty much
true. The `LuceneCountOperator` and `LuceneMinMaxOperator` sort of pretend
that the count/min/max that they emit is a "document" - but that's good
enough to give you a sense of what's going on. It's *like* document.
2025-04-16 17:15:25 +02:00
..
external-modules ESQL: Create fewer documents in lookup tests (#126874) 2025-04-16 05:56:47 +10:00
fixtures Refactor GCS fixture multipart parser (#125828) 2025-04-15 10:09:53 -07:00
framework ESQL: Add documents_found and values_loaded (#125631) 2025-04-16 17:15:25 +02:00
immutable-collections-patch Update ASM 9.7 -> 9.7.1 to support JDK 24 (#118094) 2024-12-06 08:16:46 +01:00
logger-usage Update ASM 9.7 -> 9.7.1 to support JDK 24 (#118094) 2024-12-06 08:16:46 +01:00
metadata-extractor Remove historical features infrastructure (#117043) 2024-11-24 19:39:09 +00:00
test-clusters Use logs dir as working directory (#124966) 2025-04-09 07:07:11 -07:00
x-content Use directory name as project name for libs (#115720) 2024-10-29 13:02:28 -07:00
yaml-rest-runner Improve handling of empty response (#125562) 2025-04-07 12:10:07 +01:00
build.gradle Add AGPLv3 as a supported license 2024-09-13 15:29:46 -07:00