Skip to content

Commit de9e423

Browse files
Merge remote-tracking branch 'elastic/main' into all-in-one-query-change
2 parents fa32445 + 1e12b54 commit de9e423

File tree

66 files changed

+842
-413
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+842
-413
lines changed

docs/changelog/121552.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 121552
2+
summary: Fix a bug in TOP
3+
area: ES|QL
4+
type: bug
5+
issues: []

docs/changelog/121568.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 121568
2+
summary: Analyze API to return 400 for wrong custom analyzer
3+
area: Analysis
4+
type: bug
5+
issues:
6+
- 121443

modules/analysis-common/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ esplugin {
2020

2121
restResources {
2222
restApi {
23-
include '_common', 'indices', 'index', 'cluster', 'search', 'nodes', 'bulk', 'termvectors', 'explain', 'count'
23+
include '_common', 'indices', 'index', 'cluster', 'search', 'nodes', 'bulk', 'termvectors', 'explain', 'count', 'capabilities'
2424
}
2525
}
2626

modules/analysis-common/src/yamlRestTest/resources/rest-api-spec/test/indices.analyze/15_analyze.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,28 @@
5959
- match: { detail.tokenizer.tokens.0.token: ABc }
6060
- match: { detail.tokenfilters.0.name: lowercase }
6161
- match: { detail.tokenfilters.0.tokens.0.token: abc }
62+
63+
---
64+
"Custom analyzer is not buildable":
65+
- requires:
66+
test_runner_features: [ capabilities ]
67+
reason: This capability required to run test
68+
capabilities:
69+
- method: GET
70+
path: /_analyze
71+
capabilities: [ wrong_custom_analyzer_returns_400 ]
72+
73+
- do:
74+
catch: bad_request
75+
indices.analyze:
76+
body:
77+
text: the foxes jumping quickly
78+
tokenizer:
79+
standard
80+
filter:
81+
type: hunspell
82+
locale: en_US
83+
84+
- match: { status: 400 }
85+
- match: { error.type: illegal_argument_exception }
86+
- match: { error.reason: "Can not build a custom analyzer" }

muted-tests.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,13 +391,11 @@ tests:
391391
- class: org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryStopIT
392392
method: testStopQueryLocal
393393
issue: https://github.com/elastic/elasticsearch/issues/121672
394-
- class: org.elasticsearch.xpack.esql.heap_attack.HeapAttackIT
395-
method: testLookupExplosionBigStringManyMatches
396-
issue: https://github.com/elastic/elasticsearch/issues/121465
397394
- class: org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT
398395
issue: https://github.com/elastic/elasticsearch/issues/121411
399-
- class: org.elasticsearch.xpack.migrate.action.ReindexDatastreamIndexTransportActionIT
400-
issue: https://github.com/elastic/elasticsearch/issues/121737
396+
- class: org.elasticsearch.transport.InboundHandlerTests
397+
method: testLogsSlowInboundProcessing
398+
issue: https://github.com/elastic/elasticsearch/issues/121816
401399

402400
# Examples:
403401
#

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ static TransportVersion def(int id) {
178178
public static final TransportVersion REMOVE_SNAPSHOT_FAILURES = def(9_002_0_00);
179179
public static final TransportVersion TRANSPORT_STATS_HANDLING_TIME_REQUIRED = def(9_003_0_00);
180180
public static final TransportVersion REMOVE_DESIRED_NODE_VERSION = def(9_004_0_00);
181-
public static final TransportVersion BATCHED_QUERY_PHASE_VERSION = def(9_005_0_00);
182-
181+
public static final TransportVersion ESQL_DRIVER_TASK_DESCRIPTION = def(9_005_0_00);
182+
public static final TransportVersion BATCHED_QUERY_PHASE_VERSION = def(9_006_0_00);
183183
/*
184184
* STOP! READ THIS FIRST! No, really,
185185
* ____ _____ ___ ____ _ ____ _____ _ ____ _____ _ _ ___ ____ _____ ___ ____ ____ _____ _
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
package org.elasticsearch.action.admin.indices.analyze;
11+
12+
import java.util.Set;
13+
14+
public final class AnalyzeCapabilities {
15+
private AnalyzeCapabilities() {}
16+
17+
private static final String WRONG_CUSTOM_ANALYZER_RETURNS_400_CAPABILITY = "wrong_custom_analyzer_returns_400";
18+
19+
public static final Set<String> CAPABILITIES = Set.of(WRONG_CUSTOM_ANALYZER_RETURNS_400_CAPABILITY);
20+
}

server/src/main/java/org/elasticsearch/action/admin/indices/analyze/TransportAnalyzeAction.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ public static AnalyzeAction.Response analyze(
144144
if (analyzer != null) {
145145
return analyze(request, analyzer, maxTokenCount);
146146
}
147+
} catch (IllegalStateException e) {
148+
throw new IllegalArgumentException("Can not build a custom analyzer", e);
147149
}
148150

149151
// Otherwise we use a built-in analyzer, which should not be closed

server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
package org.elasticsearch.rest.action.admin.indices;
1010

1111
import org.elasticsearch.action.admin.indices.analyze.AnalyzeAction;
12+
import org.elasticsearch.action.admin.indices.analyze.AnalyzeCapabilities;
1213
import org.elasticsearch.client.internal.node.NodeClient;
1314
import org.elasticsearch.rest.BaseRestHandler;
1415
import org.elasticsearch.rest.RestRequest;
@@ -19,6 +20,7 @@
1920

2021
import java.io.IOException;
2122
import java.util.List;
23+
import java.util.Set;
2224

2325
import static org.elasticsearch.rest.RestRequest.Method.GET;
2426
import static org.elasticsearch.rest.RestRequest.Method.POST;
@@ -49,4 +51,9 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC
4951
}
5052
}
5153

54+
@Override
55+
public Set<String> supportedCapabilities() {
56+
return AnalyzeCapabilities.CAPABILITIES;
57+
}
58+
5259
}

0 commit comments

Comments
 (0)