Skip to content

Commit 5e14075

Browse files
committed
review comments
1 parent 0a862e0 commit 5e14075

File tree

12 files changed

+112
-99
lines changed

12 files changed

+112
-99
lines changed

docs/changelog/130847.yaml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ pr: 130847
22
summary: "Pipelines: Add `created_date` and `modified_date`"
33
area: Ingest Node
44
type: enhancement
5-
issues: []
6-
highlight:
7-
title: "Pipelines: Add `created_date` and `modified_date`"
8-
body: |-
9-
Pipelines now have extra properties to indicate when they were created, and updated, to improve visibility
10-
and debugging.
11-
These properties are managed by the system and cannot be updated by the user.
12-
notable: true
5+
issues:
6+
- 108754
7+

qa/mixed-cluster/build.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,6 @@ excludeList.add('aggregations/percentiles_hdr_metric/Negative values test')
7171
// sync_id is removed in 9.0
7272
excludeList.add("cat.shards/10_basic/Help")
7373

74-
// new optional properties only available on latest cluster
75-
excludeList.add("ingest/10_basic/Test creating and getting pipeline returns created_date and modified_date")
76-
excludeList.add("ingest/10_basic/Test PUT setting created_date")
77-
excludeList.add("ingest/10_basic/Test PUT setting modified_date")
78-
excludeList.add("simulate.ingest/10_basic/Test simulate with pipeline with created_date")
79-
8074
def clusterPath = getPath()
8175

8276
buildParams.bwcVersions.withWireCompatible { bwcVersion, baseName ->

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/ingest/10_basic.yml

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -184,49 +184,3 @@
184184
- is_false: first_pipeline.description
185185
- is_true: second_pipeline
186186
- is_false: second_pipeline.description
187-
188-
189-
---
190-
"Test creating and getting pipeline returns created_date and modified_date":
191-
- do:
192-
ingest.put_pipeline:
193-
id: "my_pipeline"
194-
body: >
195-
{
196-
"processors": []
197-
}
198-
- match: { acknowledged: true }
199-
200-
- do:
201-
ingest.get_pipeline:
202-
id: "my_pipeline"
203-
- match: { my_pipeline.created_date: "/\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z/" }
204-
- match: { my_pipeline.modified_date: "/\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z/" }
205-
206-
---
207-
"Test PUT setting created_date":
208-
- do:
209-
catch: bad_request
210-
ingest.put_pipeline:
211-
id: "my_pipeline"
212-
body: >
213-
{
214-
"processors": [],
215-
"created_date": "2025-07-04T12:50:48.415Z"
216-
}
217-
- match: { status: 400 }
218-
- match: { error.reason: "Provided a pipeline property which is managed by the system, e.g. `created_date`." }
219-
220-
---
221-
"Test PUT setting modified_date":
222-
- do:
223-
catch: bad_request
224-
ingest.put_pipeline:
225-
id: "my_pipeline"
226-
body: >
227-
{
228-
"processors": [],
229-
"modified_date": "2025-07-04T12:50:48.415Z"
230-
}
231-
- match: { status: 400 }
232-
- match: { error.reason: "Provided a pipeline property which is managed by the system, e.g. `created_date`." }
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
setup:
2+
- requires:
3+
test_runner_features: capabilities
4+
capabilities:
5+
- method: PUT
6+
path: /_ingest/pipeline/{id}
7+
capabilities: [ pipeline_tracking_info ]
8+
reason: "Pipelines have tracking info: modified_date and created_date"
9+
10+
---
11+
"Test creating and getting pipeline returns created_date and modified_date":
12+
- do:
13+
ingest.put_pipeline:
14+
id: "my_pipeline"
15+
body: >
16+
{
17+
"processors": []
18+
}
19+
- match: { acknowledged: true }
20+
21+
- do:
22+
ingest.get_pipeline:
23+
id: "my_pipeline"
24+
- match: { my_pipeline.created_date: "/\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z/" }
25+
- match: { my_pipeline.modified_date: "/\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z/" }
26+
27+
---
28+
"Test PUT setting created_date":
29+
- do:
30+
catch: bad_request
31+
ingest.put_pipeline:
32+
id: "my_pipeline"
33+
body: >
34+
{
35+
"processors": [],
36+
"created_date": "2025-07-04T12:50:48.415Z"
37+
}
38+
- match: { status: 400 }
39+
- match: { error.reason: "Provided a pipeline property which is managed by the system: created_date." }
40+
41+
---
42+
"Test PUT setting modified_date":
43+
- do:
44+
catch: bad_request
45+
ingest.put_pipeline:
46+
id: "my_pipeline"
47+
body: >
48+
{
49+
"processors": [],
50+
"modified_date": "2025-07-04T12:50:48.415Z"
51+
}
52+
- match: { status: 400 }
53+
- match: { error.reason: "Provided a pipeline property which is managed by the system: modified_date." }

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/simulate.ingest/10_basic.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,15 @@ setup:
751751

752752
---
753753
"Test simulate with pipeline with created_date":
754+
- requires:
755+
test_runner_features: capabilities
756+
capabilities:
757+
- method: PUT
758+
path: /_ingest/pipeline/{id}
759+
capabilities: [ pipeline_tracking_info ]
760+
reason: "Pipelines have tracking info: modified_date and created_date"
761+
- requires:
762+
test_runner_features: contains
754763
- skip:
755764
features: headers
756765
- do:
@@ -777,4 +786,4 @@ setup:
777786
}
778787
}
779788
- match: { status: 500 }
780-
- match: { error.reason: "/(runtime_exception:\\ )?org\\.elasticsearch\\.ElasticsearchParseException:\\ Provided\\ a\\ pipeline\\ property\\ which\\ is\\ managed\\ by\\ the\\ system,\\ e\\.g\\.\\ `created_date`\\./" }
789+
- contains: { error.reason: "Provided a pipeline property which is managed by the system: created_date." }

server/src/internalClusterTest/java/org/elasticsearch/ingest/PipelineConfigurationSyncIT.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ public void testAllNodesGetPipelineTrackingClusterState() throws Exception {
5353
assertThat(node2Pipeline.getDescription(), equalTo(node3Pipeline.getDescription()));
5454

5555
// created_date
56-
final long node1CreatedDate = node1Pipeline.getCreatedDate().orElseThrow();
57-
final long node2CreatedDate = node2Pipeline.getCreatedDate().orElseThrow();
58-
final long node3CreatedDate = node3Pipeline.getCreatedDate().orElseThrow();
56+
final long node1CreatedDate = node1Pipeline.getCreatedDateMillis().orElseThrow();
57+
final long node2CreatedDate = node2Pipeline.getCreatedDateMillis().orElseThrow();
58+
final long node3CreatedDate = node3Pipeline.getCreatedDateMillis().orElseThrow();
5959

6060
assertThat(node1CreatedDate, equalTo(node2CreatedDate));
6161
assertThat(node2CreatedDate, equalTo(node3CreatedDate));
@@ -64,9 +64,9 @@ public void testAllNodesGetPipelineTrackingClusterState() throws Exception {
6464
assertThat(node1CreatedDate, lessThanOrEqualTo(timeAfterPut));
6565

6666
// modified_date
67-
final long node1ModifiedDate = node1Pipeline.getModifiedDate().orElseThrow();
68-
final long node2ModifiedDate = node2Pipeline.getModifiedDate().orElseThrow();
69-
final long node3ModifiedDate = node3Pipeline.getModifiedDate().orElseThrow();
67+
final long node1ModifiedDate = node1Pipeline.getModifiedDateMillis().orElseThrow();
68+
final long node2ModifiedDate = node2Pipeline.getModifiedDateMillis().orElseThrow();
69+
final long node3ModifiedDate = node3Pipeline.getModifiedDateMillis().orElseThrow();
7070

7171
assertThat(node1ModifiedDate, equalTo(node2ModifiedDate));
7272
assertThat(node2ModifiedDate, equalTo(node3ModifiedDate));

server/src/main/java/org/elasticsearch/action/ingest/SimulateExecutionService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ static void executeDocument(
4242
if (verbose) {
4343
List<SimulateProcessorResult> processorResultList = new CopyOnWriteArrayList<>();
4444
CompoundProcessor verbosePipelineProcessor = decorate(pipeline.getCompoundProcessor(), null, processorResultList);
45-
long createdDate = pipeline.getCreatedDate().orElse(-1);
46-
long modifiedDate = pipeline.getModifiedDate().orElse(-1);
45+
long createdDate = pipeline.getCreatedDateMillis().orElse(-1);
46+
long modifiedDate = pipeline.getModifiedDateMillis().orElse(-1);
4747
Pipeline verbosePipeline = new Pipeline(
4848
pipeline.getId(),
4949
pipeline.getDescription(),

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,10 @@ public static Map<String, Object> readPipelineConfig(PutPipelineRequest request)
579579
}
580580

581581
public static void validateNoSystemPropertiesInPipelineConfig(final Map<String, Object> pipelineConfig) {
582-
if (pipelineConfig.containsKey(Pipeline.CREATED_DATE_KEY) || pipelineConfig.containsKey(Pipeline.MODIFIED_DATE_KEY)) {
583-
throw new ElasticsearchParseException("Provided a pipeline property which is managed by the system, e.g. `created_date`.");
582+
if (pipelineConfig.containsKey(Pipeline.CREATED_DATE_KEY)) {
583+
throw new ElasticsearchParseException("Provided a pipeline property which is managed by the system: created_date.");
584+
} else if (pipelineConfig.containsKey(Pipeline.MODIFIED_DATE_KEY)) {
585+
throw new ElasticsearchParseException("Provided a pipeline property which is managed by the system: modified_date.");
584586
}
585587
}
586588

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ public final class Pipeline {
5353
@Nullable
5454
private final Boolean deprecated;
5555
@Nullable
56-
private final Long createdDate;
56+
private final Long createdDateMillis;
5757
@Nullable
58-
private final Long modifiedDate;
58+
private final Long modifiedDateMillis;
5959

6060
public Pipeline(
6161
String id,
@@ -75,8 +75,8 @@ public Pipeline(
7575
CompoundProcessor compoundProcessor,
7676
IngestPipelineFieldAccessPattern fieldAccessPattern,
7777
@Nullable Boolean deprecated,
78-
@Nullable Long createdDate,
79-
@Nullable Long modifiedDate
78+
@Nullable Long createdDateMillis,
79+
@Nullable Long modifiedDateMillis
8080
) {
8181
this(
8282
id,
@@ -87,8 +87,8 @@ public Pipeline(
8787
System::nanoTime,
8888
fieldAccessPattern,
8989
deprecated,
90-
createdDate,
91-
modifiedDate
90+
createdDateMillis,
91+
modifiedDateMillis
9292
);
9393
}
9494

@@ -102,8 +102,8 @@ public Pipeline(
102102
LongSupplier relativeTimeProvider,
103103
IngestPipelineFieldAccessPattern fieldAccessPattern,
104104
@Nullable Boolean deprecated,
105-
@Nullable Long createdDate,
106-
@Nullable Long modifiedDate
105+
@Nullable Long createdDateMillis,
106+
@Nullable Long modifiedDateMillis
107107
) {
108108
this.id = id;
109109
this.description = description;
@@ -114,8 +114,8 @@ public Pipeline(
114114
this.relativeTimeProvider = relativeTimeProvider;
115115
this.fieldAccessPattern = fieldAccessPattern;
116116
this.deprecated = deprecated;
117-
this.createdDate = createdDate;
118-
this.modifiedDate = modifiedDate;
117+
this.createdDateMillis = createdDateMillis;
118+
this.modifiedDateMillis = modifiedDateMillis;
119119
}
120120

121121
/**
@@ -305,12 +305,12 @@ public boolean isDeprecated() {
305305
return Boolean.TRUE.equals(deprecated);
306306
}
307307

308-
public OptionalLong getCreatedDate() {
309-
return createdDate == null ? OptionalLong.empty() : OptionalLong.of(createdDate);
308+
public OptionalLong getCreatedDateMillis() {
309+
return createdDateMillis == null ? OptionalLong.empty() : OptionalLong.of(createdDateMillis);
310310
}
311311

312-
public OptionalLong getModifiedDate() {
313-
return modifiedDate == null ? OptionalLong.empty() : OptionalLong.of(modifiedDate);
312+
public OptionalLong getModifiedDateMillis() {
313+
return modifiedDateMillis == null ? OptionalLong.empty() : OptionalLong.of(modifiedDateMillis);
314314
}
315315

316316
@Override
@@ -325,8 +325,8 @@ public String toString() {
325325
sb.append(", relativeTimeProvider=").append(relativeTimeProvider);
326326
sb.append(", fieldAccessPattern=").append(fieldAccessPattern);
327327
sb.append(", deprecated=").append(deprecated);
328-
sb.append(", createdDate=").append(createdDate);
329-
sb.append(", modifiedDate=").append(modifiedDate);
328+
sb.append(", createdDateMillis=").append(createdDateMillis);
329+
sb.append(", modifiedDateMillis=").append(modifiedDateMillis);
330330
sb.append('}');
331331
return sb.toString();
332332
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ private void decorateAndExecutePipeline(
210210
conditionalWithResult
211211
)
212212
);
213-
long createdDate = pipeline.getCreatedDate().orElse(-1);
214-
long modifiedDate = pipeline.getModifiedDate().orElse(-1);
213+
long createdDate = pipeline.getCreatedDateMillis().orElse(-1);
214+
long modifiedDate = pipeline.getModifiedDateMillis().orElse(-1);
215215
Pipeline verbosePipeline = new Pipeline(
216216
pipeline.getId(),
217217
pipeline.getDescription(),

0 commit comments

Comments
 (0)