Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into lucene_snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
pmpailis committed Oct 3, 2024
2 parents ae92b29 + cd42719 commit 97afb5c
Show file tree
Hide file tree
Showing 57 changed files with 3,965 additions and 1,121 deletions.
7 changes: 1 addition & 6 deletions docs/reference/search/rrf.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,12 @@ We have both the ranker's `score` and the `_rank` option to show our top-ranked
"value" : 5,
"relation" : "eq"
},
"max_score" : null,
"max_score" : ...,
"hits" : [
{
"_index" : "example-index",
"_id" : "3",
"_score" : 0.8333334,
"_rank" : 1,
"_source" : {
"integer" : 1,
"vector" : [
Expand All @@ -319,7 +318,6 @@ We have both the ranker's `score` and the `_rank` option to show our top-ranked
"_index" : "example-index",
"_id" : "2",
"_score" : 0.5833334,
"_rank" : 2,
"_source" : {
"integer" : 2,
"vector" : [
Expand All @@ -332,7 +330,6 @@ We have both the ranker's `score` and the `_rank` option to show our top-ranked
"_index" : "example-index",
"_id" : "4",
"_score" : 0.5,
"_rank" : 3,
"_source" : {
"integer" : 2,
"text" : "rrf rrf rrf rrf"
Expand Down Expand Up @@ -499,7 +496,6 @@ Working with the example above, and by adding `explain=true` to the search reque
"_index": "example-index",
"_id": "3",
"_score": 0.8333334,
"_rank": 1,
"_explanation":
{
"value": 0.8333334, <1>
Expand Down Expand Up @@ -608,7 +604,6 @@ The response would now include the named query in the explanation:
"_index": "example-index",
"_id": "3",
"_score": 0.8333334,
"_rank": 1,
"_explanation":
{
"value": 0.8333334,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.elasticsearch.action.datastreams.GetDataStreamAction;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.cluster.metadata.DataStream;
import org.elasticsearch.cluster.metadata.DataStreamLifecycle;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.util.set.Sets;
Expand All @@ -35,12 +36,12 @@ public class RestGetDataStreamsAction extends BaseRestHandler {
Set.of(
"name",
"include_defaults",
"timeout",
"master_timeout",
IndicesOptions.WildcardOptions.EXPAND_WILDCARDS,
IndicesOptions.ConcreteTargetOptions.IGNORE_UNAVAILABLE,
IndicesOptions.WildcardOptions.ALLOW_NO_INDICES,
IndicesOptions.GatekeeperOptions.IGNORE_THROTTLED,
DataStream.isFailureStoreFeatureFlagEnabled() ? IndicesOptions.FailureStoreOptions.FAILURE_STORE : "name",
"verbose"
)
)
Expand Down
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,6 @@ tests:
- class: org.elasticsearch.kibana.KibanaThreadPoolIT
method: testBlockedThreadPoolsRejectUserRequests
issue: https://github.com/elastic/elasticsearch/issues/113939
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
method: test {p0=indices.create/20_synthetic_source/object array in object with dynamic override}
issue: https://github.com/elastic/elasticsearch/issues/113966
- class: org.elasticsearch.xpack.inference.TextEmbeddingCrudIT
method: testPutE5Small_withPlatformAgnosticVariant
issue: https://github.com/elastic/elasticsearch/issues/113983
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@

package org.elasticsearch.http;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.support.PlainActionFuture;
import org.elasticsearch.client.Cancellable;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.Response;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.CollectionUtils;
Expand All @@ -29,6 +31,8 @@
import org.elasticsearch.index.shard.IndexShardTestCase;
import org.elasticsearch.index.translog.TranslogStats;
import org.elasticsearch.indices.IndicesService;
import org.elasticsearch.logging.LogManager;
import org.elasticsearch.logging.Logger;
import org.elasticsearch.plugins.EnginePlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.tasks.Task;
Expand Down Expand Up @@ -141,6 +145,12 @@ public List<Setting<?>> getSettings() {

private static class SearcherBlockingEngine extends ReadOnlyEngine {

// using a specialized logger for this case because and "logger" means "Engine#logger"
// (relates investigation into https://github.com/elastic/elasticsearch/issues/88201)
private static final Logger blockedSearcherRestCancellationTestCaseLogger = LogManager.getLogger(
BlockedSearcherRestCancellationTestCase.class
);

final Semaphore searcherBlock = new Semaphore(1);

SearcherBlockingEngine(EngineConfig config) {
Expand All @@ -149,12 +159,36 @@ private static class SearcherBlockingEngine extends ReadOnlyEngine {

@Override
public Searcher acquireSearcher(String source, SearcherScope scope, Function<Searcher, Searcher> wrapper) throws EngineException {
if (blockedSearcherRestCancellationTestCaseLogger.isDebugEnabled()) {
blockedSearcherRestCancellationTestCaseLogger.debug(
Strings.format(
"in acquireSearcher for shard [%s] on thread [%s], availablePermits=%d",
config().getShardId(),
Thread.currentThread().getName(),
searcherBlock.availablePermits()
),
new ElasticsearchException("stack trace")
);
}

try {
searcherBlock.acquire();
} catch (InterruptedException e) {
throw new AssertionError(e);
}
searcherBlock.release();

if (blockedSearcherRestCancellationTestCaseLogger.isDebugEnabled()) {
blockedSearcherRestCancellationTestCaseLogger.debug(
Strings.format(
"continuing in acquireSearcher for shard [%s] on thread [%s], availablePermits=%d",
config().getShardId(),
Thread.currentThread().getName(),
searcherBlock.availablePermits()
)
);
}

return super.acquireSearcher(source, scope, wrapper);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,23 @@
import org.apache.http.client.methods.HttpGet;
import org.elasticsearch.action.admin.indices.segments.IndicesSegmentsAction;
import org.elasticsearch.client.Request;
import org.elasticsearch.test.junit.annotations.TestIssueLogging;

public class IndicesSegmentsRestCancellationIT extends BlockedSearcherRestCancellationTestCase {
@TestIssueLogging(
issueUrl = "https://github.com/elastic/elasticsearch/issues/88201",
value = "org.elasticsearch.http.BlockedSearcherRestCancellationTestCase:DEBUG"
+ ",org.elasticsearch.transport.TransportService:TRACE"
)
public void testIndicesSegmentsRestCancellation() throws Exception {
runTest(new Request(HttpGet.METHOD_NAME, "/_segments"), IndicesSegmentsAction.NAME);
}

@TestIssueLogging(
issueUrl = "https://github.com/elastic/elasticsearch/issues/88201",
value = "org.elasticsearch.http.BlockedSearcherRestCancellationTestCase:DEBUG"
+ ",org.elasticsearch.transport.TransportService:TRACE"
)
public void testCatSegmentsRestCancellation() throws Exception {
runTest(new Request(HttpGet.METHOD_NAME, "/_cat/segments"), IndicesSegmentsAction.NAME);
}
Expand Down
Loading

0 comments on commit 97afb5c

Please sign in to comment.