Skip to content

Commit 8e155b8

Browse files
INGEST: Rename Pipeline Processor Param. (#34733)
* `name` is more readable/ergnomic than having `pipeline` twice
1 parent 83fd93b commit 8e155b8

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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 5 additions & 5 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public Factory(IngestService ingestService) {
6565
public PipelineProcessor create(Map<String, Processor.Factory> registry, String processorTag,
6666
Map<String, Object> config) throws Exception {
6767
String pipeline =
68-
ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "pipeline");
68+
ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "name");
6969
return new PipelineProcessor(processorTag, pipeline, ingestService);
7070
}
7171
}

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public String getTag() {
6262
when(ingestService.getPipeline(pipelineId)).thenReturn(pipeline);
6363
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);
6464
Map<String, Object> config = new HashMap<>();
65-
config.put("pipeline", pipelineId);
65+
config.put("name", pipelineId);
6666
factory.create(Collections.emptyMap(), null, config).execute(testIngestDocument);
6767
assertEquals(testIngestDocument, invoked.get());
6868
}
@@ -72,7 +72,7 @@ public void testThrowsOnMissingPipeline() throws Exception {
7272
IngestDocument testIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
7373
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);
7474
Map<String, Object> config = new HashMap<>();
75-
config.put("pipeline", "missingPipelineId");
75+
config.put("name", "missingPipelineId");
7676
IllegalStateException e = expectThrows(
7777
IllegalStateException.class,
7878
() -> factory.create(Collections.emptyMap(), null, config).execute(testIngestDocument)
@@ -88,21 +88,21 @@ public void testThrowsOnRecursivePipelineInvocations() throws Exception {
8888
IngestService ingestService = mock(IngestService.class);
8989
IngestDocument testIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
9090
Map<String, Object> outerConfig = new HashMap<>();
91-
outerConfig.put("pipeline", innerPipelineId);
91+
outerConfig.put("name", innerPipelineId);
9292
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);
9393
Pipeline outer = new Pipeline(
9494
outerPipelineId, null, null,
9595
new CompoundProcessor(factory.create(Collections.emptyMap(), null, outerConfig))
9696
);
9797
Map<String, Object> innerConfig = new HashMap<>();
98-
innerConfig.put("pipeline", outerPipelineId);
98+
innerConfig.put("name", outerPipelineId);
9999
Pipeline inner = new Pipeline(
100100
innerPipelineId, null, null,
101101
new CompoundProcessor(factory.create(Collections.emptyMap(), null, innerConfig))
102102
);
103103
when(ingestService.getPipeline(outerPipelineId)).thenReturn(outer);
104104
when(ingestService.getPipeline(innerPipelineId)).thenReturn(inner);
105-
outerConfig.put("pipeline", innerPipelineId);
105+
outerConfig.put("name", innerPipelineId);
106106
ElasticsearchException e = expectThrows(
107107
ElasticsearchException.class,
108108
() -> factory.create(Collections.emptyMap(), null, outerConfig).execute(testIngestDocument)
@@ -117,7 +117,7 @@ public void testAllowsRepeatedPipelineInvocations() throws Exception {
117117
IngestService ingestService = mock(IngestService.class);
118118
IngestDocument testIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
119119
Map<String, Object> outerConfig = new HashMap<>();
120-
outerConfig.put("pipeline", innerPipelineId);
120+
outerConfig.put("name", innerPipelineId);
121121
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);
122122
Pipeline inner = new Pipeline(
123123
innerPipelineId, null, null, new CompoundProcessor()
@@ -136,11 +136,11 @@ public void testPipelineProcessorWithPipelineChain() throws Exception {
136136
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);
137137

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

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

146146
Clock clock = mock(Clock.class);

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

Lines changed: 4 additions & 4 deletions
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)