-
Notifications
You must be signed in to change notification settings - Fork 25.6k
ESQL: Opt in to support for new aggregate_metric_double and dense_vector using query constructs
#135215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESQL: Opt in to support for new aggregate_metric_double and dense_vector using query constructs
#135215
Changes from 34 commits
870db5f
c541fbd
ef1da90
6d546f9
c5c40cb
ce91be1
dae8a4a
d7f00df
654abde
1945205
aae54e9
67b4e73
3780362
5249481
09c4eb9
72d338f
d25151c
280da8a
abd851a
206560c
b9fee12
a1d2389
61110ab
ef0c269
663c15a
1da11c7
a76afc1
1e8c58b
90e21a0
c30668f
77b59d4
a515924
9102fcd
8f2d210
8b6c45f
c60a704
f38c8a1
78a85db
86005ad
9919907
fef79ba
60e7e05
435d233
940a3b2
d4cfad8
94784ab
0d9c027
d2a5064
d172d26
20472de
280daf8
85771e7
cd0ce72
e71115c
d694176
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| package org.elasticsearch.xpack.esql.core.type; | ||
|
|
||
| import org.elasticsearch.TransportVersion; | ||
|
|
||
| /** | ||
| * Version that supports a {@link DataType}. | ||
| */ | ||
| public interface CreatedVersion { | ||
| boolean supports(TransportVersion version); | ||
|
|
||
| CreatedVersion SUPPORTED_ON_ALL_NODES = new CreatedVersion() { | ||
| @Override | ||
| public boolean supports(TransportVersion version) { | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "SupportedOnAllVersions"; | ||
| } | ||
| }; | ||
|
|
||
| static CreatedVersion supportedOn(TransportVersion createdVersion) { | ||
| return new CreatedVersion() { | ||
| @Override | ||
| public boolean supports(TransportVersion version) { | ||
| return version.supports(createdVersion); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "SupportedOn[" + createdVersion + "]"; | ||
| } | ||
| }; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| package org.elasticsearch.xpack.esql.qa.mixed; | ||
|
|
||
| import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; | ||
|
|
||
| import org.elasticsearch.index.IndexMode; | ||
| import org.elasticsearch.index.mapper.MappedFieldType; | ||
| import org.elasticsearch.test.TestClustersThreadFilter; | ||
| import org.elasticsearch.test.cluster.ElasticsearchCluster; | ||
| import org.elasticsearch.xpack.esql.qa.rest.AllSupportedFieldsTestCase; | ||
| import org.junit.ClassRule; | ||
|
|
||
| /** | ||
| * Fetch all field types in a mixed version cluster, simulating a rolling upgrade. | ||
| */ | ||
| @ThreadLeakFilters(filters = TestClustersThreadFilter.class) | ||
| public class AllSupportedFieldsIT extends AllSupportedFieldsTestCase { | ||
| @ClassRule | ||
| public static ElasticsearchCluster cluster = Clusters.mixedVersionCluster(); | ||
|
|
||
| public AllSupportedFieldsIT(MappedFieldType.FieldExtractPreference extractPreference, IndexMode indexMode) { | ||
| super(extractPreference, indexMode); | ||
| } | ||
|
|
||
| @Override | ||
| protected String getTestRestCluster() { | ||
| return cluster.getHttpAddresses(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| package org.elasticsearch.xpack.esql.ccq; | ||
|
|
||
| import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; | ||
|
|
||
| import org.apache.http.HttpHost; | ||
| import org.elasticsearch.client.RestClient; | ||
| import org.elasticsearch.core.IOUtils; | ||
| import org.elasticsearch.index.IndexMode; | ||
| import org.elasticsearch.index.mapper.MappedFieldType; | ||
| import org.elasticsearch.test.TestClustersThreadFilter; | ||
| import org.elasticsearch.test.cluster.ElasticsearchCluster; | ||
| import org.elasticsearch.xpack.esql.qa.rest.AllSupportedFieldsTestCase; | ||
| import org.junit.AfterClass; | ||
| import org.junit.Before; | ||
| import org.junit.ClassRule; | ||
| import org.junit.rules.RuleChain; | ||
| import org.junit.rules.TestRule; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.Map; | ||
| import java.util.TreeMap; | ||
|
|
||
| /** | ||
| * Fetch all field types via cross cluster search, possible on a different version. | ||
| */ | ||
| @ThreadLeakFilters(filters = TestClustersThreadFilter.class) | ||
| public class AllSupportedFieldsIT extends AllSupportedFieldsTestCase { | ||
| static ElasticsearchCluster remoteCluster = Clusters.remoteCluster(); | ||
| static ElasticsearchCluster localCluster = Clusters.localCluster(remoteCluster); | ||
|
|
||
| @ClassRule | ||
| public static TestRule clusterRule = RuleChain.outerRule(remoteCluster).around(localCluster); | ||
|
|
||
| private static RestClient remoteClient; | ||
| private static Map<String, NodeInfo> remoteNodeToInfo; | ||
|
|
||
| public AllSupportedFieldsIT(MappedFieldType.FieldExtractPreference extractPreference, IndexMode indexMode) { | ||
| super(extractPreference, indexMode); | ||
| } | ||
|
|
||
| @Before | ||
| public void createRemoteIndices() throws IOException { | ||
| for (Map.Entry<String, NodeInfo> e : remoteNodeToInfo().entrySet()) { | ||
| createIndexForNode(remoteClient(), e.getKey(), e.getValue().id()); | ||
| } | ||
| } | ||
|
|
||
| private Map<String, NodeInfo> remoteNodeToInfo() throws IOException { | ||
| if (remoteNodeToInfo == null) { | ||
| remoteNodeToInfo = fetchNodeToInfo(remoteClient(), "remote_cluster"); | ||
| } | ||
| return remoteNodeToInfo; | ||
| } | ||
|
|
||
| @Override | ||
| protected Map<String, NodeInfo> allNodeToInfo() throws IOException { | ||
| Map<String, NodeInfo> all = new TreeMap<>(); | ||
| all.putAll(super.allNodeToInfo()); | ||
| all.putAll(remoteNodeToInfo()); | ||
| return all; | ||
| } | ||
|
|
||
| private RestClient remoteClient() throws IOException { | ||
| if (remoteClient == null) { | ||
| var clusterHosts = parseClusterHosts(remoteCluster.getHttpAddresses()); | ||
| remoteClient = buildClient(restClientSettings(), clusterHosts.toArray(new HttpHost[0])); | ||
| } | ||
| return remoteClient; | ||
| } | ||
|
|
||
| @Override | ||
| protected String getTestRestCluster() { | ||
| return localCluster.getHttpAddresses(); | ||
| } | ||
|
|
||
| @AfterClass | ||
| public static void closeRemoteClient() throws IOException { | ||
| try { | ||
| IOUtils.close(remoteClient); | ||
| } finally { | ||
| remoteClient = null; | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| package org.elasticsearch.xpack.esql.qa.single_node; | ||
|
|
||
| import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; | ||
|
|
||
| import org.elasticsearch.index.IndexMode; | ||
| import org.elasticsearch.index.mapper.MappedFieldType; | ||
| import org.elasticsearch.test.TestClustersThreadFilter; | ||
| import org.elasticsearch.test.cluster.ElasticsearchCluster; | ||
| import org.elasticsearch.xpack.esql.qa.rest.AllSupportedFieldsTestCase; | ||
| import org.junit.ClassRule; | ||
|
|
||
| /** | ||
| * Simple test for fetching all supported field types. | ||
| */ | ||
| @ThreadLeakFilters(filters = TestClustersThreadFilter.class) | ||
| public class AllSupportedFieldsIT extends AllSupportedFieldsTestCase { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's useful here because it serves as a smoke test for the ground "it works" state. Kind of a self test for the test. |
||
| @ClassRule | ||
| public static ElasticsearchCluster cluster = Clusters.testCluster(c -> {}); | ||
|
|
||
| public AllSupportedFieldsIT(MappedFieldType.FieldExtractPreference extractPreference, IndexMode indexMode) { | ||
| super(extractPreference, indexMode); | ||
| } | ||
|
|
||
| @Override | ||
| protected String getTestRestCluster() { | ||
| return cluster.getHttpAddresses(); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.