Skip to content

Commit 8b7022f

Browse files
committed
Merge remote-tracking branch 'upstream/main' into enhancement/add_ilm_delete_index
2 parents b9b3095 + fcf0408 commit 8b7022f

File tree

4 files changed

+33
-20
lines changed

4 files changed

+33
-20
lines changed

muted-tests.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -500,12 +500,6 @@ tests:
500500
- class: org.elasticsearch.test.rest.yaml.MDPYamlTestSuiteIT
501501
method: test {yaml=mdp/10_basic/Index using shared data path}
502502
issue: https://github.com/elastic/elasticsearch/issues/132223
503-
- class: org.elasticsearch.xpack.logsdb.qa.StandardVersusStandardReindexedIntoLogsDbChallengeRestIT
504-
method: testTermsQuery
505-
issue: https://github.com/elastic/elasticsearch/issues/132225
506-
- class: org.elasticsearch.xpack.logsdb.qa.StoredSourceLogsDbVersusReindexedLogsDbChallengeRestIT
507-
method: testTermsQuery
508-
issue: https://github.com/elastic/elasticsearch/issues/132226
509503
- class: org.elasticsearch.xpack.sql.qa.mixed_node.SqlCompatIT
510504
method: testNullsOrderWithMissingOrderSupportQueryingNewNode
511505
issue: https://github.com/elastic/elasticsearch/issues/132249
@@ -533,9 +527,6 @@ tests:
533527
- class: org.elasticsearch.xpack.logsdb.qa.LogsDbVersusReindexedLogsDbChallengeRestIT
534528
method: testTermsQuery
535529
issue: https://github.com/elastic/elasticsearch/issues/132337
536-
- class: org.elasticsearch.search.suggest.phrase.PhraseSuggesterIT
537-
method: testPhraseSuggestionWithNgramOnlyAnalyzerThrowsException
538-
issue: https://github.com/elastic/elasticsearch/issues/132347
539530
- class: org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryIT
540531
method: testBadAsyncId
541532
issue: https://github.com/elastic/elasticsearch/issues/132353

server/src/internalClusterTest/java/org/elasticsearch/search/suggest/phrase/PhraseSuggesterIT.java

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
package org.elasticsearch.search.suggest.phrase;
1111

12+
import org.elasticsearch.action.search.SearchPhaseExecutionException;
1213
import org.elasticsearch.action.search.SearchRequestBuilder;
1314
import org.elasticsearch.action.search.ShardSearchFailure;
1415
import org.elasticsearch.common.settings.Settings;
@@ -49,15 +50,25 @@ public void testPhraseSuggestionWithNgramOnlyAnalyzerThrowsException() throws IO
4950
// 4. NoisyChannelSpellChecker.end() throws IllegalArgumentException
5051
SearchRequestBuilder searchBuilder = createSuggesterSearch("text.ngrams");
5152

52-
assertResponse(searchBuilder, response -> {
53-
assertThat(response.status(), equalTo(RestStatus.OK));
54-
assertThat(response.getFailedShards(), greaterThan(0));
55-
assertThat(response.getShardFailures().length, greaterThan(0));
56-
for (ShardSearchFailure shardFailure : response.getShardFailures()) {
57-
assertTrue(shardFailure.getCause() instanceof IllegalArgumentException);
58-
assertEquals("At least one unigram is required but all tokens were ngrams", shardFailure.getCause().getMessage());
59-
}
60-
});
53+
try {
54+
assertResponse(searchBuilder, response -> {
55+
// We didn't fail all shards - we get a response with failed shards
56+
assertThat(response.status(), equalTo(RestStatus.OK));
57+
assertThat(response.getFailedShards(), greaterThan(0));
58+
assertThat(response.getShardFailures().length, greaterThan(0));
59+
checkShardFailures(response.getShardFailures());
60+
});
61+
} catch (SearchPhaseExecutionException e) {
62+
// If all shards fail, we get a SearchPhaseExecutionException
63+
checkShardFailures(e.shardFailures());
64+
}
65+
}
66+
67+
private static void checkShardFailures(ShardSearchFailure[] shardFailures) {
68+
for (ShardSearchFailure shardFailure : shardFailures) {
69+
assertTrue(shardFailure.getCause() instanceof IllegalArgumentException);
70+
assertEquals("At least one unigram is required but all tokens were ngrams", shardFailure.getCause().getMessage());
71+
}
6172
}
6273

6374
private static SearchRequestBuilder createSuggesterSearch(String fieldName) {
@@ -104,7 +115,7 @@ private void createIndexAndDocs(boolean outputUnigrams) throws IOException {
104115
assertAcked(
105116
prepareCreate("test").setSettings(
106117
Settings.builder()
107-
.put(SETTING_NUMBER_OF_SHARDS, randomIntBetween(1, 5))
118+
.put(SETTING_NUMBER_OF_SHARDS, randomIntBetween(1, 10))
108119
.put("index.analysis.analyzer.ngram_only.tokenizer", "standard")
109120
.putList("index.analysis.analyzer.ngram_only.filter", "my_shingle", "lowercase")
110121
.put("index.analysis.filter.my_shingle.type", "shingle")

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ public void analyzedPlan(
364364
QueryBuilder requestFilter,
365365
ActionListener<LogicalPlan> logicalPlanListener
366366
) {
367+
assert ThreadPool.assertCurrentThreadPool(ThreadPool.Names.SEARCH);
367368
if (parsed.analyzed()) {
368369
logicalPlanListener.onResponse(parsed);
369370
return;
@@ -440,6 +441,11 @@ private void preAnalyzeLookupIndex(
440441
String localPattern = lookupIndexPattern.indexPattern();
441442
assert RemoteClusterAware.isRemoteIndexName(localPattern) == false
442443
: "Lookup index name should not include remote, but got: " + localPattern;
444+
assert ThreadPool.assertCurrentThreadPool(
445+
ThreadPool.Names.SEARCH,
446+
ThreadPool.Names.SEARCH_COORDINATION,
447+
ThreadPool.Names.SYSTEM_READ
448+
);
443449
Set<String> fieldNames = result.wildcardJoinIndices().contains(localPattern) ? IndexResolver.ALL_FIELDS : result.fieldNames;
444450

445451
String patternWithRemotes;
@@ -625,6 +631,11 @@ private void preAnalyzeMainIndices(
625631
QueryBuilder requestFilter,
626632
ActionListener<PreAnalysisResult> listener
627633
) {
634+
assert ThreadPool.assertCurrentThreadPool(
635+
ThreadPool.Names.SEARCH,
636+
ThreadPool.Names.SEARCH_COORDINATION,
637+
ThreadPool.Names.SYSTEM_READ
638+
);
628639
// TODO we plan to support joins in the future when possible, but for now we'll just fail early if we see one
629640
List<IndexPattern> indices = preAnalysis.indices;
630641
if (indices.size() > 1) {

x-pack/plugin/logsdb/src/javaRestTest/java/org/elasticsearch/xpack/logsdb/qa/StandardVersusLogsIndexModeChallengeRestIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public abstract class StandardVersusLogsIndexModeChallengeRestIT extends Abstrac
6060
protected final DataGenerationHelper dataGenerationHelper;
6161

6262
public StandardVersusLogsIndexModeChallengeRestIT() {
63-
this(new DataGenerationHelper());
63+
this(new DataGenerationHelper(builder -> builder.withMaxFieldCountPerLevel(30)));
6464
}
6565

6666
protected StandardVersusLogsIndexModeChallengeRestIT(DataGenerationHelper dataGenerationHelper) {

0 commit comments

Comments
 (0)