|
@@ -19,6 +19,8 @@
|
|
|
|
|
|
package org.elasticsearch.client.rollup;
|
|
|
|
|
|
+import org.elasticsearch.client.core.IndexerJobStats;
|
|
|
+import org.elasticsearch.client.core.IndexerState;
|
|
|
import org.elasticsearch.client.rollup.job.config.RollupJobConfig;
|
|
|
import org.elasticsearch.common.ParseField;
|
|
|
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
|
@@ -27,7 +29,6 @@ import org.elasticsearch.common.xcontent.XContentParser;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.util.List;
|
|
|
-import java.util.Locale;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
|
|
@@ -44,19 +45,10 @@ public class GetRollupJobResponse {
|
|
|
static final ParseField CONFIG = new ParseField("config");
|
|
|
static final ParseField STATS = new ParseField("stats");
|
|
|
static final ParseField STATUS = new ParseField("status");
|
|
|
- static final ParseField NUM_PAGES = new ParseField("pages_processed");
|
|
|
- static final ParseField NUM_INPUT_DOCUMENTS = new ParseField("documents_processed");
|
|
|
- static final ParseField NUM_OUTPUT_DOCUMENTS = new ParseField("rollups_indexed");
|
|
|
- static final ParseField NUM_INVOCATIONS = new ParseField("trigger_count");
|
|
|
static final ParseField STATE = new ParseField("job_state");
|
|
|
static final ParseField CURRENT_POSITION = new ParseField("current_position");
|
|
|
+ static final ParseField ROLLUPS_INDEXED = new ParseField("rollups_indexed");
|
|
|
static final ParseField UPGRADED_DOC_ID = new ParseField("upgraded_doc_id");
|
|
|
- static final ParseField INDEX_TIME_IN_MS = new ParseField("index_time_in_ms");
|
|
|
- static final ParseField SEARCH_TIME_IN_MS = new ParseField("search_time_in_ms");
|
|
|
- static final ParseField INDEX_TOTAL = new ParseField("index_total");
|
|
|
- static final ParseField SEARCH_TOTAL = new ParseField("search_total");
|
|
|
- static final ParseField SEARCH_FAILURES = new ParseField("search_failures");
|
|
|
- static final ParseField INDEX_FAILURES = new ParseField("index_failures");
|
|
|
|
|
|
private List<JobWrapper> jobs;
|
|
|
|
|
@@ -182,101 +174,12 @@ public class GetRollupJobResponse {
|
|
|
* The Rollup specialization of stats for the AsyncTwoPhaseIndexer.
|
|
|
* Note: instead of `documents_indexed`, this XContent show `rollups_indexed`
|
|
|
*/
|
|
|
- public static class RollupIndexerJobStats {
|
|
|
- private final long numPages;
|
|
|
- private final long numInputDocuments;
|
|
|
- private final long numOuputDocuments;
|
|
|
- private final long numInvocations;
|
|
|
- private long indexTime;
|
|
|
- private long indexTotal;
|
|
|
- private long searchTime;
|
|
|
- private long searchTotal;
|
|
|
- private long indexFailures;
|
|
|
- private long searchFailures;
|
|
|
+ public static class RollupIndexerJobStats extends IndexerJobStats {
|
|
|
|
|
|
RollupIndexerJobStats(long numPages, long numInputDocuments, long numOuputDocuments, long numInvocations,
|
|
|
long indexTime, long indexTotal, long searchTime, long searchTotal, long indexFailures, long searchFailures) {
|
|
|
- this.numPages = numPages;
|
|
|
- this.numInputDocuments = numInputDocuments;
|
|
|
- this.numOuputDocuments = numOuputDocuments;
|
|
|
- this.numInvocations = numInvocations;
|
|
|
- this.indexTime = indexTime;
|
|
|
- this.indexTotal = indexTotal;
|
|
|
- this.searchTime = searchTime;
|
|
|
- this.searchTotal = searchTotal;
|
|
|
- this.indexFailures = indexFailures;
|
|
|
- this.searchFailures = searchFailures;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * The number of pages read from the input indices.
|
|
|
- */
|
|
|
- public long getNumPages() {
|
|
|
- return numPages;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * The number of documents read from the input indices.
|
|
|
- */
|
|
|
- public long getNumDocuments() {
|
|
|
- return numInputDocuments;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Number of times that the job woke up to write documents.
|
|
|
- */
|
|
|
- public long getNumInvocations() {
|
|
|
- return numInvocations;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Number of documents written to the result indices.
|
|
|
- */
|
|
|
- public long getOutputDocuments() {
|
|
|
- return numOuputDocuments;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Number of failures that have occurred during the bulk indexing phase of Rollup
|
|
|
- */
|
|
|
- public long getIndexFailures() {
|
|
|
- return indexFailures;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Number of failures that have occurred during the search phase of Rollup
|
|
|
- */
|
|
|
- public long getSearchFailures() {
|
|
|
- return searchFailures;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Returns the time spent indexing (cumulative) in milliseconds
|
|
|
- */
|
|
|
- public long getIndexTime() {
|
|
|
- return indexTime;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Returns the time spent searching (cumulative) in milliseconds
|
|
|
- */
|
|
|
- public long getSearchTime() {
|
|
|
- return searchTime;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Returns the total number of indexing requests that have been sent by the rollup job
|
|
|
- * (Note: this is not the number of _documents_ that have been indexed)
|
|
|
- */
|
|
|
- public long getIndexTotal() {
|
|
|
- return indexTotal;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Returns the total number of search requests that have been sent by the rollup job
|
|
|
- */
|
|
|
- public long getSearchTotal() {
|
|
|
- return searchTotal;
|
|
|
+ super(numPages, numInputDocuments, numOuputDocuments, numInvocations,
|
|
|
+ indexTime, searchTime, indexTotal, searchTotal, indexFailures, searchFailures);
|
|
|
}
|
|
|
|
|
|
private static final ConstructingObjectParser<RollupIndexerJobStats, Void> PARSER = new ConstructingObjectParser<>(
|
|
@@ -287,7 +190,7 @@ public class GetRollupJobResponse {
|
|
|
static {
|
|
|
PARSER.declareLong(constructorArg(), NUM_PAGES);
|
|
|
PARSER.declareLong(constructorArg(), NUM_INPUT_DOCUMENTS);
|
|
|
- PARSER.declareLong(constructorArg(), NUM_OUTPUT_DOCUMENTS);
|
|
|
+ PARSER.declareLong(constructorArg(), ROLLUPS_INDEXED);
|
|
|
PARSER.declareLong(constructorArg(), NUM_INVOCATIONS);
|
|
|
PARSER.declareLong(constructorArg(), INDEX_TIME_IN_MS);
|
|
|
PARSER.declareLong(constructorArg(), INDEX_TOTAL);
|
|
@@ -296,43 +199,6 @@ public class GetRollupJobResponse {
|
|
|
PARSER.declareLong(constructorArg(), INDEX_FAILURES);
|
|
|
PARSER.declareLong(constructorArg(), SEARCH_FAILURES);
|
|
|
}
|
|
|
-
|
|
|
- @Override
|
|
|
- public boolean equals(Object other) {
|
|
|
- if (this == other) return true;
|
|
|
- if (other == null || getClass() != other.getClass()) return false;
|
|
|
- RollupIndexerJobStats that = (RollupIndexerJobStats) other;
|
|
|
- return Objects.equals(this.numPages, that.numPages)
|
|
|
- && Objects.equals(this.numInputDocuments, that.numInputDocuments)
|
|
|
- && Objects.equals(this.numOuputDocuments, that.numOuputDocuments)
|
|
|
- && Objects.equals(this.numInvocations, that.numInvocations)
|
|
|
- && Objects.equals(this.indexTime, that.indexTime)
|
|
|
- && Objects.equals(this.searchTime, that.searchTime)
|
|
|
- && Objects.equals(this.indexFailures, that.indexFailures)
|
|
|
- && Objects.equals(this.searchFailures, that.searchFailures)
|
|
|
- && Objects.equals(this.searchTotal, that.searchTotal)
|
|
|
- && Objects.equals(this.indexTotal, that.indexTotal);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public int hashCode() {
|
|
|
- return Objects.hash(numPages, numInputDocuments, numOuputDocuments, numInvocations,
|
|
|
- indexTime, searchTime, indexFailures, searchFailures, searchTotal, indexTotal);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public final String toString() {
|
|
|
- return "{pages=" + numPages
|
|
|
- + ", input_docs=" + numInputDocuments
|
|
|
- + ", output_docs=" + numOuputDocuments
|
|
|
- + ", invocations=" + numInvocations
|
|
|
- + ", index_failures=" + indexFailures
|
|
|
- + ", search_failures=" + searchFailures
|
|
|
- + ", index_time_in_ms=" + indexTime
|
|
|
- + ", index_total=" + indexTotal
|
|
|
- + ", search_time_in_ms=" + searchTime
|
|
|
- + ", search_total=" + searchTotal+ "}";
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -417,40 +283,4 @@ public class GetRollupJobResponse {
|
|
|
+ ", upgradedDocumentId=" + upgradedDocumentId + "}";
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * IndexerState represents the internal state of the indexer. It
|
|
|
- * is also persistent when changing from started/stopped in case the allocated
|
|
|
- * task is restarted elsewhere.
|
|
|
- */
|
|
|
- public enum IndexerState {
|
|
|
- /** Indexer is running, but not actively indexing data (e.g. it's idle). */
|
|
|
- STARTED,
|
|
|
-
|
|
|
- /** Indexer is actively indexing data. */
|
|
|
- INDEXING,
|
|
|
-
|
|
|
- /**
|
|
|
- * Transition state to where an indexer has acknowledged the stop
|
|
|
- * but is still in process of halting.
|
|
|
- */
|
|
|
- STOPPING,
|
|
|
-
|
|
|
- /** Indexer is "paused" and ignoring scheduled triggers. */
|
|
|
- STOPPED,
|
|
|
-
|
|
|
- /**
|
|
|
- * Something (internal or external) has requested the indexer abort
|
|
|
- * and shutdown.
|
|
|
- */
|
|
|
- ABORTING;
|
|
|
-
|
|
|
- static IndexerState fromString(String name) {
|
|
|
- return valueOf(name.trim().toUpperCase(Locale.ROOT));
|
|
|
- }
|
|
|
-
|
|
|
- String value() {
|
|
|
- return name().toLowerCase(Locale.ROOT);
|
|
|
- }
|
|
|
- }
|
|
|
}
|