Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public void onPartialReduce(List<SearchShard> shards, TotalHits totalHits, Inter

for (Map.Entry<String, Integer> entry : totalByClusterAlias.entrySet()) {
String clusterAlias = entry.getKey();
int successfulCount = entry.getValue().intValue();
int successfulCount = entry.getValue();

clusters.swapCluster(clusterAlias, (k, v) -> {
SearchResponse.Cluster.Status status = v.getStatus();
Expand Down Expand Up @@ -231,7 +231,7 @@ public void onFinalReduce(List<SearchShard> shards, TotalHits totalHits, Interna

for (Map.Entry<String, Integer> entry : totalByClusterAlias.entrySet()) {
String clusterAlias = entry.getKey();
int successfulCount = entry.getValue().intValue();
int successfulCount = entry.getValue();

clusters.swapCluster(clusterAlias, (k, v) -> {
SearchResponse.Cluster.Status status = v.getStatus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
* store any other information.
*/
class CountOnlyQueryPhaseResultConsumer extends SearchPhaseResults<SearchPhaseResult> {
AtomicReference<TotalHits.Relation> relationAtomicReference = new AtomicReference<>(TotalHits.Relation.EQUAL_TO);
LongAdder totalHits = new LongAdder();
final AtomicReference<TotalHits.Relation> relationAtomicReference = new AtomicReference<>(TotalHits.Relation.EQUAL_TO);
final LongAdder totalHits = new LongAdder();

private final AtomicBoolean terminatedEarly = new AtomicBoolean(false);
private final AtomicBoolean timedOut = new AtomicBoolean(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,6 @@ public SearchRequestBuilder setWaitForCheckpoints(Map<String, long[]> waitForChe
return this;
}

/**
* Set the timeout for the {@link #setWaitForCheckpoints(Map)} request.
*/
public SearchRequestBuilder setWaitForCheckpointsTimeout(final TimeValue waitForCheckpointsTimeout) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@original-brownbear this is used in stateless (in a test at least). Can you revert?

request.setWaitForCheckpointsTimeout(waitForCheckpointsTimeout);
return this;
}

/**
* Specifies what type of requested indices to ignore and wildcard indices expressions.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ public boolean hasPartialResults() {
* for tracking search Cluster details.
*/
public boolean hasClusterObjects() {
return clusterInfo.keySet().size() > 0;
return clusterInfo.isEmpty() == false;
}

/**
Expand Down Expand Up @@ -855,27 +855,6 @@ public Cluster(String clusterAlias, String indexExpression, boolean skipUnavaila
this(clusterAlias, indexExpression, skipUnavailable, Status.RUNNING, null, null, null, null, null, null, false);
}

/**
* Create a Cluster with a new Status and one or more ShardSearchFailures. This constructor
* should only be used for fatal failures where shard counters (total, successful, skipped, failed)
* are not known (unset).
* @param clusterAlias clusterAlias as defined in the remote cluster settings or RemoteClusterAware.LOCAL_CLUSTER_GROUP_KEY
* for the local cluster
* @param indexExpression the original (not resolved/concrete) indices expression provided for this cluster.
* @param skipUnavailable whether cluster is marked as skip_unavailable in remote cluster settings
* @param status current status of the search on this Cluster
* @param failures list of failures that occurred during the search on this Cluster
*/
public Cluster(
String clusterAlias,
String indexExpression,
boolean skipUnavailable,
Status status,
List<ShardSearchFailure> failures
) {
this(clusterAlias, indexExpression, skipUnavailable, status, null, null, null, null, failures, null, false);
}

public Cluster(
String clusterAlias,
String indexExpression,
Expand Down Expand Up @@ -1034,7 +1013,7 @@ public void writeTo(StreamOutput out) throws IOException {
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
String name = clusterAlias;
if (clusterAlias.equals("")) {
if (clusterAlias.isEmpty()) {
name = LOCAL_CLUSTER_NAME_REPRESENTATION;
}
builder.startObject(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations;

import java.io.IOException;
Expand All @@ -25,10 +24,6 @@ public class InternalDateRange extends InternalRange<InternalDateRange.Bucket, I

public static class Bucket extends InternalRange.Bucket {

public Bucket(String key, double from, double to, long docCount, List<InternalAggregation> aggregations, DocValueFormat formatter) {
super(key, from, to, docCount, InternalAggregations.from(aggregations), formatter);
}

public Bucket(String key, double from, double to, long docCount, InternalAggregations aggregations, DocValueFormat formatter) {
super(key, from, to, docCount, aggregations, formatter);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,6 @@ public PointInTimeBuilder setKeepAlive(TimeValue keepAlive) {
return this;
}

/**
* If specified, the search layer will keep this point in time around for at least the given keep-alive.
* Otherwise, the point in time will be kept around until the original keep alive elapsed.
*/
public PointInTimeBuilder setKeepAlive(String keepAlive) {
return setKeepAlive(TimeValue.parseTimeValue(keepAlive, "keep_alive"));
}

@Nullable
public TimeValue getKeepAlive() {
return keepAlive;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
package org.elasticsearch.search.fetch;

import org.apache.lucene.search.Query;
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
import org.elasticsearch.index.mapper.SourceFieldMapper;
import org.elasticsearch.index.mapper.SourceLoader;
import org.elasticsearch.index.query.ParsedQuery;
Expand Down Expand Up @@ -88,10 +87,6 @@ private static StoredFieldsContext buildStoredFieldsContext(SearchContext in) {
return sfc;
}

public BitsetFilterCache bitsetFilterCache() {
return searchContext.bitsetFilterCache();
}

/**
* The name of the index that documents are being fetched from
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,17 +327,6 @@ private static void transferOptions(
}
}

static Character[] convertCharArray(char[] array) {
if (array == null) {
return null;
}
Character[] charArray = new Character[array.length];
for (int i = 0; i < array.length; i++) {
charArray[i] = array[i];
}
return charArray;
}

@Override
public void innerXContent(XContentBuilder builder) throws IOException {
// first write common options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public final class KnnRetrieverBuilder extends RetrieverBuilder {
RESCORE_VECTOR_FIELD,
ObjectParser.ValueType.OBJECT
);
RetrieverBuilder.declareBaseParserFields(NAME, PARSER);
RetrieverBuilder.declareBaseParserFields(PARSER);
}

public static KnnRetrieverBuilder fromXContent(XContentParser parser, RetrieverParserContext context) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public final class RescorerRetrieverBuilder extends CompoundRetrieverBuilder<Res
);
}
}, RESCORE_FIELD, ObjectParser.ValueType.OBJECT_ARRAY);
RetrieverBuilder.declareBaseParserFields(NAME, PARSER);
RetrieverBuilder.declareBaseParserFields(PARSER);
}

public static RescorerRetrieverBuilder fromXContent(XContentParser parser, RetrieverParserContext context) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ public abstract class RetrieverBuilder implements Rewriteable<RetrieverBuilder>,

public static final ParseField NAME_FIELD = new ParseField("_name");

protected static void declareBaseParserFields(
String name,
AbstractObjectParser<? extends RetrieverBuilder, RetrieverParserContext> parser
) {
protected static void declareBaseParserFields(AbstractObjectParser<? extends RetrieverBuilder, RetrieverParserContext> parser) {
parser.declareObjectArray(
(r, v) -> r.preFilterQueryBuilders = new ArrayList<>(v),
(p, c) -> AbstractQueryBuilder.parseTopLevelQuery(p, c::trackQueryUsage),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public final class StandardRetrieverBuilder extends RetrieverBuilder implements
COLLAPSE_FIELD,
ObjectParser.ValueType.OBJECT
);
RetrieverBuilder.declareBaseParserFields(NAME, PARSER);
RetrieverBuilder.declareBaseParserFields(PARSER);
}

public static StandardRetrieverBuilder fromXContent(XContentParser parser, RetrieverParserContext context) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
package org.elasticsearch.search.suggest.phrase;

import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.MultiTerms;
import org.apache.lucene.index.Terms;
import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.util.BytesRef;
Expand All @@ -30,10 +29,6 @@ public abstract class WordScorer {
private final TermsEnum termsEnum;
private final boolean useTotalTermFreq;

public WordScorer(IndexReader reader, String field, double realWordLikelihood, BytesRef separator) throws IOException {
this(reader, MultiTerms.getTerms(reader, field), field, realWordLikelihood, separator);
}

public WordScorer(IndexReader reader, Terms terms, String field, double realWordLikelihood, BytesRef separator) throws IOException {
if (terms == null) {
throw new IllegalArgumentException("Field: [" + field + "] does not exist");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public final class QueryRuleRetrieverBuilder extends CompoundRetrieverBuilder<Qu
return innerRetriever;
}, RETRIEVER_FIELD);
PARSER.declareInt(optionalConstructorArg(), RANK_WINDOW_SIZE_FIELD);
RetrieverBuilder.declareBaseParserFields(NAME, PARSER);
RetrieverBuilder.declareBaseParserFields(PARSER);
}

public static QueryRuleRetrieverBuilder fromXContent(XContentParser parser, RetrieverParserContext context) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class RandomRankRetrieverBuilder extends RetrieverBuilder {
PARSER.declareInt(optionalConstructorArg(), RANK_WINDOW_SIZE_FIELD);
PARSER.declareInt(optionalConstructorArg(), SEED_FIELD);

RetrieverBuilder.declareBaseParserFields(RandomRankBuilder.NAME, PARSER);
RetrieverBuilder.declareBaseParserFields(PARSER);
}

public static RandomRankRetrieverBuilder fromXContent(XContentParser parser, RetrieverParserContext context) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class TextSimilarityRankRetrieverBuilder extends CompoundRetrieverBuilder
PARSER.declareInt(optionalConstructorArg(), RANK_WINDOW_SIZE_FIELD);
PARSER.declareBoolean(optionalConstructorArg(), FAILURES_ALLOWED_FIELD);

RetrieverBuilder.declareBaseParserFields(TextSimilarityRankBuilder.NAME, PARSER);
RetrieverBuilder.declareBaseParserFields(PARSER);
}

public static TextSimilarityRankRetrieverBuilder fromXContent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public final class LinearRetrieverBuilder extends CompoundRetrieverBuilder<Linea
static {
PARSER.declareObjectArray(constructorArg(), LinearRetrieverComponent::fromXContent, RETRIEVERS_FIELD);
PARSER.declareInt(optionalConstructorArg(), RANK_WINDOW_SIZE_FIELD);
RetrieverBuilder.declareBaseParserFields(NAME, PARSER);
RetrieverBuilder.declareBaseParserFields(PARSER);
}

private static float[] getDefaultWeight(int size) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public final class RRFRetrieverBuilder extends CompoundRetrieverBuilder<RRFRetri
}, RETRIEVERS_FIELD);
PARSER.declareInt(optionalConstructorArg(), RANK_WINDOW_SIZE_FIELD);
PARSER.declareInt(optionalConstructorArg(), RANK_CONSTANT_FIELD);
RetrieverBuilder.declareBaseParserFields(NAME, PARSER);
RetrieverBuilder.declareBaseParserFields(PARSER);
}

public static RRFRetrieverBuilder fromXContent(XContentParser parser, RetrieverParserContext context) throws IOException {
Expand Down