Skip to content

Commit b5bf239

Browse files
committed
Add to response
``` { "took" : 194, "is_partial" : false, "documents_found" : 100000, "values_loaded" : 200000, "columns" : [ { "name" : "a", "type" : "long" }, { "name" : "b", "type" : "long" } ], "values" : [[10, 1]] } ```
1 parent fb36e7e commit b5bf239

File tree

20 files changed

+391
-128
lines changed

20 files changed

+391
-128
lines changed

server/src/main/java/org/elasticsearch/common/Strings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ public static String toString(ChunkedToXContent chunkedToXContent, boolean prett
822822
* Allows to configure the params.
823823
* Allows to control whether the outputted json needs to be pretty printed and human readable.
824824
*/
825-
private static String toString(ToXContent toXContent, ToXContent.Params params, boolean pretty, boolean human) {
825+
public static String toString(ToXContent toXContent, ToXContent.Params params, boolean pretty, boolean human) {
826826
try {
827827
XContentBuilder builder = createBuilder(pretty, human);
828828
if (toXContent.isFragment()) {

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/DriverCompletionInfo.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* the request.
2727
*/
2828
public record DriverCompletionInfo(long documentsFound, long valuesLoaded, List<DriverProfile> collectedProfiles) implements Writeable {
29+
2930
/**
3031
* Completion info we use when we didn't properly complete any drivers.
3132
* Usually this is returned with an error, but it's also used when receiving

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -921,9 +921,9 @@ public enum Cap {
921921

922922
/**
923923
* Are the {@code documents_found} and {@code values_loaded} fields available
924-
* in the profile?
924+
* in the response and profile?
925925
*/
926-
PROFILE_DOCUMENTS_FOUND,
926+
DOCUMENTS_FOUND,
927927

928928
/**
929929
* Index component selector syntax (my-data-stream-name::failures)

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlQueryResponse.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ static EsqlQueryResponse deserialize(BlockStreamInput in) throws IOException {
119119
}
120120
List<ColumnInfoImpl> columns = in.readCollectionAsList(ColumnInfoImpl::new);
121121
List<Page> pages = in.readCollectionAsList(Page::new);
122-
long documentsFound = in.getTransportVersion().onOrAfter(ESQL_VALUES_LOADED) ? in.readVInt() : 0;
123-
long valuesLoaded = in.getTransportVersion().onOrAfter(ESQL_VALUES_LOADED) ? in.readVInt() : 0;
122+
long documentsFound = in.getTransportVersion().onOrAfter(ESQL_VALUES_LOADED) ? in.readVLong() : 0;
123+
long valuesLoaded = in.getTransportVersion().onOrAfter(ESQL_VALUES_LOADED) ? in.readVLong() : 0;
124124
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
125125
profile = in.readOptionalWriteable(Profile::new);
126126
}
@@ -188,6 +188,14 @@ public Iterator<Object> column(int columnIndex) {
188188
return ResponseValueUtils.valuesForColumn(columnIndex, columns.get(columnIndex).type(), pages);
189189
}
190190

191+
public long documentsFound() {
192+
return documentsFound;
193+
}
194+
195+
public long valuesLoaded() {
196+
return valuesLoaded;
197+
}
198+
191199
public Profile profile() {
192200
return profile;
193201
}

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/ClusterComputeHandler.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import org.elasticsearch.action.OriginalIndices;
1313
import org.elasticsearch.action.support.ChannelActionListener;
1414
import org.elasticsearch.compute.operator.DriverCompletionInfo;
15-
import org.elasticsearch.compute.operator.DriverProfile;
1615
import org.elasticsearch.compute.operator.exchange.ExchangeService;
1716
import org.elasticsearch.compute.operator.exchange.ExchangeSourceHandler;
1817
import org.elasticsearch.core.Releasable;

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/ComputeListener.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,10 @@
1111
import org.elasticsearch.action.support.RefCountingListener;
1212
import org.elasticsearch.compute.EsqlRefCountingListener;
1313
import org.elasticsearch.compute.operator.DriverCompletionInfo;
14-
import org.elasticsearch.compute.operator.DriverProfile;
1514
import org.elasticsearch.compute.operator.ResponseHeadersCollector;
1615
import org.elasticsearch.core.Releasable;
1716
import org.elasticsearch.threadpool.ThreadPool;
1817

19-
import java.util.ArrayList;
20-
import java.util.Collections;
21-
import java.util.List;
22-
import java.util.concurrent.atomic.AtomicLong;
23-
2418
/**
2519
* A variant of {@link RefCountingListener} with the following differences:
2620
* 1. Automatically cancels sub tasks on failure (via runOnTaskFailure)

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/ComputeService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import org.elasticsearch.compute.data.Page;
1919
import org.elasticsearch.compute.operator.Driver;
2020
import org.elasticsearch.compute.operator.DriverCompletionInfo;
21-
import org.elasticsearch.compute.operator.DriverProfile;
2221
import org.elasticsearch.compute.operator.DriverTaskRunner;
2322
import org.elasticsearch.compute.operator.exchange.ExchangeService;
2423
import org.elasticsearch.compute.operator.exchange.ExchangeSourceHandler;

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/DataNodeComputeResponse.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
import org.elasticsearch.transport.TransportResponse;
1616

1717
import java.io.IOException;
18-
import java.util.List;
1918
import java.util.Map;
20-
import java.util.Objects;
2119

2220
import static org.elasticsearch.TransportVersions.ESQL_VALUES_LOADED;
2321

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/DataNodeRequestSender.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.elasticsearch.common.breaker.CircuitBreakingException;
2323
import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
2424
import org.elasticsearch.compute.operator.DriverCompletionInfo;
25-
import org.elasticsearch.compute.operator.DriverProfile;
2625
import org.elasticsearch.compute.operator.FailureCollector;
2726
import org.elasticsearch.core.TimeValue;
2827
import org.elasticsearch.index.Index;

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session/EsqlSession.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import org.elasticsearch.compute.data.Block;
1919
import org.elasticsearch.compute.data.Page;
2020
import org.elasticsearch.compute.operator.DriverCompletionInfo;
21-
import org.elasticsearch.compute.operator.DriverProfile;
2221
import org.elasticsearch.core.Releasables;
2322
import org.elasticsearch.core.TimeValue;
2423
import org.elasticsearch.index.IndexMode;

0 commit comments

Comments
 (0)