Skip to content

Commit 832987e

Browse files
authored
[Behavioral Analytics] Analytics pipeline to the index template registry (#96104)
* move the pipeline to the index template registry * remove unneeded utils for pipeline install * fix tests + added coverage for ingest pipeline * fix cancellable search request * disable search parameter tests
1 parent 815b021 commit 832987e

File tree

10 files changed

+94
-672
lines changed

10 files changed

+94
-672
lines changed

x-pack/plugin/ent-search/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/entsearch/EnterpriseSearchRestIT.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@
99

1010
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
1111

12-
import org.apache.lucene.tests.util.LuceneTestCase;
1312
import org.elasticsearch.common.settings.SecureString;
1413
import org.elasticsearch.common.settings.Settings;
1514
import org.elasticsearch.common.util.concurrent.ThreadContext;
1615
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
1716
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
1817

19-
@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/95917")
2018
public class EnterpriseSearchRestIT extends ESClientYamlSuiteTestCase {
2119

2220
public EnterpriseSearchRestIT(final ClientYamlTestCandidate testCandidate) {

x-pack/plugin/ent-search/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/55_search_application_search.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ teardown:
9292

9393
---
9494
"Query Search Application with default parameters":
95+
- skip:
96+
version: all
97+
reason: "AwaitsFix https://github.com/elastic/enterprise-search-team/issues/4540"
9598

9699
- do:
97100
search_application.search:
@@ -103,6 +106,9 @@ teardown:
103106

104107
---
105108
"Query Search Application overriding part of the parameters":
109+
- skip:
110+
version: all
111+
reason: "AwaitsFix https://github.com/elastic/enterprise-search-team/issues/4540"
106112

107113
- do:
108114
search_application.search:
@@ -117,6 +123,9 @@ teardown:
117123

118124
---
119125
"Query Search Application overriding all parameters":
126+
- skip:
127+
version: all
128+
reason: "AwaitsFix https://github.com/elastic/enterprise-search-team/issues/4540"
120129

121130
- do:
122131
search_application.search:
@@ -132,6 +141,9 @@ teardown:
132141

133142
---
134143
"Query Search Application with invalid parameter validation":
144+
- skip:
145+
version: all
146+
reason: "AwaitsFix https://github.com/elastic/enterprise-search-team/issues/4540"
135147

136148
- do:
137149
catch: "bad_request"
@@ -144,6 +156,9 @@ teardown:
144156

145157
---
146158
"Query Search Application without required parameter":
159+
- skip:
160+
version: all
161+
reason: "AwaitsFix https://github.com/elastic/enterprise-search-team/issues/4540"
147162

148163
- do:
149164
catch: "bad_request"

x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/EnterpriseSearch.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import org.elasticsearch.tracing.Tracer;
3838
import org.elasticsearch.watcher.ResourceWatcherService;
3939
import org.elasticsearch.xcontent.NamedXContentRegistry;
40-
import org.elasticsearch.xpack.application.analytics.AnalyticsIngestPipelineRegistry;
4140
import org.elasticsearch.xpack.application.analytics.AnalyticsTemplateRegistry;
4241
import org.elasticsearch.xpack.application.analytics.action.DeleteAnalyticsCollectionAction;
4342
import org.elasticsearch.xpack.application.analytics.action.GetAnalyticsCollectionAction;
@@ -183,13 +182,7 @@ public Collection<Object> createComponents(
183182
);
184183
analyticsTemplateRegistry.initialize();
185184

186-
final AnalyticsIngestPipelineRegistry analyticsPipelineRegistry = new AnalyticsIngestPipelineRegistry(
187-
clusterService,
188-
threadPool,
189-
client
190-
);
191-
192-
return Arrays.asList(analyticsTemplateRegistry, analyticsPipelineRegistry);
185+
return Arrays.asList(analyticsTemplateRegistry);
193186
}
194187

195188
@Override

x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/analytics/AnalyticsIngestPipelineRegistry.java

Lines changed: 0 additions & 77 deletions
This file was deleted.

x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/analytics/AnalyticsTemplateRegistry.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.elasticsearch.xpack.core.ilm.LifecyclePolicy;
1919
import org.elasticsearch.xpack.core.template.IndexTemplateConfig;
2020
import org.elasticsearch.xpack.core.template.IndexTemplateRegistry;
21+
import org.elasticsearch.xpack.core.template.IngestPipelineConfig;
2122
import org.elasticsearch.xpack.core.template.LifecyclePolicyConfig;
2223

2324
import java.io.IOException;
@@ -48,6 +49,8 @@ public class AnalyticsTemplateRegistry extends IndexTemplateRegistry {
4849
static final String EVENT_DATA_STREAM_SETTINGS_COMPONENT_NAME = EVENT_DATA_STREAM_INDEX_PREFIX + "settings";
4950
static final String EVENT_DATA_STREAM_MAPPINGS_COMPONENT_NAME = EVENT_DATA_STREAM_INDEX_PREFIX + "mappings";
5051

52+
static final String EVENT_DATA_STREAM_INGEST_PIPELINE_NAME = EVENT_DATA_STREAM_INDEX_PREFIX + "final_pipeline";
53+
5154
static final Map<String, ComponentTemplate> COMPONENT_TEMPLATES;
5255

5356
static {
@@ -78,6 +81,18 @@ public class AnalyticsTemplateRegistry extends IndexTemplateRegistry {
7881
COMPONENT_TEMPLATES = Map.copyOf(componentTemplates);
7982
}
8083

84+
@Override
85+
protected List<IngestPipelineConfig> getIngestPipelines() {
86+
return List.of(
87+
new IngestPipelineConfig(
88+
EVENT_DATA_STREAM_INGEST_PIPELINE_NAME,
89+
ROOT_RESOURCE_PATH + EVENT_DATA_STREAM_INGEST_PIPELINE_NAME + ".json",
90+
REGISTRY_VERSION,
91+
TEMPLATE_VERSION_VARIABLE
92+
)
93+
);
94+
}
95+
8196
// Composable index templates configuration.
8297
static final String EVENT_DATA_STREAM_TEMPLATE_NAME = EVENT_DATA_STREAM_INDEX_PREFIX + "default";
8398
static final String EVENT_DATA_STREAM_TEMPLATE_FILENAME = EVENT_DATA_STREAM_INDEX_PREFIX + "template";

x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/search/action/SearchApplicationSearchRequest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
import org.elasticsearch.common.io.stream.StreamInput;
1414
import org.elasticsearch.common.io.stream.StreamOutput;
1515
import org.elasticsearch.core.Nullable;
16+
import org.elasticsearch.tasks.CancellableTask;
17+
import org.elasticsearch.tasks.Task;
18+
import org.elasticsearch.tasks.TaskId;
1619
import org.elasticsearch.xcontent.ConstructingObjectParser;
1720
import org.elasticsearch.xcontent.ParseField;
1821
import org.elasticsearch.xcontent.XContentParser;
@@ -83,6 +86,11 @@ public ActionRequestValidationException validate() {
8386
return validationException;
8487
}
8588

89+
@Override
90+
public Task createTask(long id, String type, String action, TaskId parentTaskId, Map<String, String> headers) {
91+
return new CancellableTask(id, type, action, getDescription(), parentTaskId, headers);
92+
}
93+
8694
@Override
8795
public void writeTo(StreamOutput out) throws IOException {
8896
super.writeTo(out);

0 commit comments

Comments
 (0)