Skip to content

Commit dd2bbfd

Browse files
original-brownbearjakelandis
authored andcommitted
INGEST: Rename Pipeline Processor Param. (elastic#34733)
* `name` is more readable/ergnomic than having `pipeline` twice
1 parent 368c6f2 commit dd2bbfd

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/210_pipeline_processor.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ teardown:
4444
"processors" : [
4545
{
4646
"pipeline" : {
47-
"pipeline": "inner"
47+
"name": "inner"
4848
}
4949
}
5050
]
@@ -78,7 +78,7 @@ teardown:
7878
"processors" : [
7979
{
8080
"pipeline" : {
81-
"pipeline": "inner"
81+
"name": "inner"
8282
}
8383
}
8484
]
@@ -94,7 +94,7 @@ teardown:
9494
"processors" : [
9595
{
9696
"pipeline" : {
97-
"pipeline": "outer"
97+
"name": "outer"
9898
}
9999
}
100100
]

modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/90_simulate.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ teardown:
617617
"processors" : [
618618
{
619619
"pipeline" : {
620-
"pipeline": "inner"
620+
"name": "inner"
621621
}
622622
}
623623
]
@@ -633,7 +633,7 @@ teardown:
633633
"processors" : [
634634
{
635635
"pipeline" : {
636-
"pipeline": "outer"
636+
"name": "outer"
637637
}
638638
}
639639
]
@@ -650,7 +650,7 @@ teardown:
650650
"processors" : [
651651
{
652652
"pipeline" : {
653-
"pipeline": "outer"
653+
"name": "outer"
654654
}
655655
}
656656
]
@@ -686,7 +686,7 @@ teardown:
686686
},
687687
{
688688
"pipeline": {
689-
"pipeline": "pipeline2"
689+
"name": "pipeline2"
690690
}
691691
}
692692
]
@@ -724,7 +724,7 @@ teardown:
724724
},
725725
{
726726
"pipeline": {
727-
"pipeline": "pipeline1"
727+
"name": "pipeline1"
728728
}
729729
}
730730
]

server/src/main/java/org/elasticsearch/ingest/PipelineProcessor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public Factory(IngestService ingestService) {
6969
public PipelineProcessor create(Map<String, Processor.Factory> registry, String processorTag,
7070
Map<String, Object> config) throws Exception {
7171
String pipeline =
72-
ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "pipeline");
72+
ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "name");
7373
return new PipelineProcessor(processorTag, pipeline, ingestService);
7474
}
7575
}

server/src/test/java/org/elasticsearch/ingest/PipelineProcessorTests.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public String getTag() {
6363
when(ingestService.getPipeline(pipelineId)).thenReturn(pipeline);
6464
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);
6565
Map<String, Object> config = new HashMap<>();
66-
config.put("pipeline", pipelineId);
66+
config.put("name", pipelineId);
6767
factory.create(Collections.emptyMap(), null, config).execute(testIngestDocument);
6868
assertEquals(testIngestDocument, invoked.get());
6969
}
@@ -73,7 +73,7 @@ public void testThrowsOnMissingPipeline() throws Exception {
7373
IngestDocument testIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
7474
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);
7575
Map<String, Object> config = new HashMap<>();
76-
config.put("pipeline", "missingPipelineId");
76+
config.put("name", "missingPipelineId");
7777
IllegalStateException e = expectThrows(
7878
IllegalStateException.class,
7979
() -> factory.create(Collections.emptyMap(), null, config).execute(testIngestDocument)
@@ -89,21 +89,21 @@ public void testThrowsOnRecursivePipelineInvocations() throws Exception {
8989
IngestService ingestService = mock(IngestService.class);
9090
IngestDocument testIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
9191
Map<String, Object> outerConfig = new HashMap<>();
92-
outerConfig.put("pipeline", innerPipelineId);
92+
outerConfig.put("name", innerPipelineId);
9393
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);
9494
Pipeline outer = new Pipeline(
9595
outerPipelineId, null, null,
9696
new CompoundProcessor(factory.create(Collections.emptyMap(), null, outerConfig))
9797
);
9898
Map<String, Object> innerConfig = new HashMap<>();
99-
innerConfig.put("pipeline", outerPipelineId);
99+
innerConfig.put("name", outerPipelineId);
100100
Pipeline inner = new Pipeline(
101101
innerPipelineId, null, null,
102102
new CompoundProcessor(factory.create(Collections.emptyMap(), null, innerConfig))
103103
);
104104
when(ingestService.getPipeline(outerPipelineId)).thenReturn(outer);
105105
when(ingestService.getPipeline(innerPipelineId)).thenReturn(inner);
106-
outerConfig.put("pipeline", innerPipelineId);
106+
outerConfig.put("name", innerPipelineId);
107107
ElasticsearchException e = expectThrows(
108108
ElasticsearchException.class,
109109
() -> factory.create(Collections.emptyMap(), null, outerConfig).execute(testIngestDocument)
@@ -118,7 +118,7 @@ public void testAllowsRepeatedPipelineInvocations() throws Exception {
118118
IngestService ingestService = mock(IngestService.class);
119119
IngestDocument testIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
120120
Map<String, Object> outerConfig = new HashMap<>();
121-
outerConfig.put("pipeline", innerPipelineId);
121+
outerConfig.put("name", innerPipelineId);
122122
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);
123123
Pipeline inner = new Pipeline(
124124
innerPipelineId, null, null, new CompoundProcessor()
@@ -137,11 +137,11 @@ public void testPipelineProcessorWithPipelineChain() throws Exception {
137137
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);
138138

139139
Map<String, Object> pipeline1ProcessorConfig = new HashMap<>();
140-
pipeline1ProcessorConfig.put("pipeline", pipeline2Id);
140+
pipeline1ProcessorConfig.put("name", pipeline2Id);
141141
PipelineProcessor pipeline1Processor = factory.create(Collections.emptyMap(), null, pipeline1ProcessorConfig);
142142

143143
Map<String, Object> pipeline2ProcessorConfig = new HashMap<>();
144-
pipeline2ProcessorConfig.put("pipeline", pipeline3Id);
144+
pipeline2ProcessorConfig.put("name", pipeline3Id);
145145
PipelineProcessor pipeline2Processor = factory.create(Collections.emptyMap(), null, pipeline2ProcessorConfig);
146146

147147
LongSupplier relativeTimeProvider = mock(LongSupplier.class);

server/src/test/java/org/elasticsearch/ingest/TrackingResultProcessorTests.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public void testActualPipelineProcessor() throws Exception {
158158
String pipelineId = "pipeline1";
159159
IngestService ingestService = mock(IngestService.class);
160160
Map<String, Object> pipelineConfig = new HashMap<>();
161-
pipelineConfig.put("pipeline", pipelineId);
161+
pipelineConfig.put("name", pipelineId);
162162
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);
163163

164164
String key1 = randomAlphaOfLength(10);
@@ -204,7 +204,7 @@ public void testActualPipelineProcessorWithHandledFailure() throws Exception {
204204
String pipelineId = "pipeline1";
205205
IngestService ingestService = mock(IngestService.class);
206206
Map<String, Object> pipelineConfig = new HashMap<>();
207-
pipelineConfig.put("pipeline", pipelineId);
207+
pipelineConfig.put("name", pipelineId);
208208
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);
209209

210210
String key1 = randomAlphaOfLength(10);
@@ -256,7 +256,7 @@ public void testActualPipelineProcessorWithCycle() throws Exception {
256256
String pipelineId = "pipeline1";
257257
IngestService ingestService = mock(IngestService.class);
258258
Map<String, Object> pipelineConfig = new HashMap<>();
259-
pipelineConfig.put("pipeline", pipelineId);
259+
pipelineConfig.put("name", pipelineId);
260260
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);
261261

262262
PipelineProcessor pipelineProcessor = factory.create(Collections.emptyMap(), null, pipelineConfig);
@@ -277,7 +277,7 @@ public void testActualPipelineProcessorRepeatedInvocation() throws Exception {
277277
String pipelineId = "pipeline1";
278278
IngestService ingestService = mock(IngestService.class);
279279
Map<String, Object> pipelineConfig = new HashMap<>();
280-
pipelineConfig.put("pipeline", pipelineId);
280+
pipelineConfig.put("name", pipelineId);
281281
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);
282282

283283
String key1 = randomAlphaOfLength(10);

0 commit comments

Comments
 (0)