Skip to content

Commit 39b3f18

Browse files
committed
Points to personal ES repo which provides Stable API interface updates. Removes required upwrap interface since upstream moved to default method. Utilizes metadata version field since upstream made it accessible.
1 parent b23e19a commit 39b3f18

File tree

4 files changed

+5
-25
lines changed

4 files changed

+5
-25
lines changed

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
LOGSTASH_PATH=../../logstash
2-
ELASTICSEARCH_TREEISH=main
2+
ELASTICSEARCH_REPO=mashhurs/elasticsearch
3+
ELASTICSEARCH_TREEISH=move-to-bridge-stable-api-investigation

src/main/java/co/elastic/logstash/filters/elasticintegration/IngestDuplexMarshaller.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,11 @@ private Set<Object> externalize(final @Nonnull Set<?> internalSet) {
198198
* @param event the event to fetch fallback values from
199199
*/
200200
private void sanitizeIngestDocumentRequiredMetadataVersion(final Map<String,Object> sourceAndMetadata, final Event event) {
201-
// TODO: make IngestDocument.Metadata.VERSION.getFieldName() available
202-
Object sourceVersion = safeLongFrom(sourceAndMetadata.remove("_version"));
201+
Object sourceVersion = safeLongFrom(sourceAndMetadata.remove(IngestDocumentBridge.Constants.METADATA_VERSION_FIELD_NAME));
203202
if (Objects.isNull(sourceVersion)) {
204203
sourceVersion = safeLongFrom(event.getField(org.logstash.Event.VERSION));
205204
}
206-
// TODO: make IngestDocument.Metadata.VERSION.getFieldName() available
207-
sourceAndMetadata.put("_version", Objects.requireNonNullElse(sourceVersion, 1L));
205+
sourceAndMetadata.put(IngestDocumentBridge.Constants.METADATA_VERSION_FIELD_NAME, Objects.requireNonNullElse(sourceVersion, 1L));
208206
}
209207

210208
/**

src/main/java/co/elastic/logstash/filters/elasticintegration/ingest/PipelineProcessor.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

99
import co.elastic.logstash.filters.elasticintegration.IngestPipeline;
1010
import co.elastic.logstash.filters.elasticintegration.IngestPipelineResolver;
11-
import org.apache.logging.log4j.LogManager;
12-
import org.apache.logging.log4j.Logger;
13-
import org.elasticsearch.ingest.Processor;
1411
import org.elasticsearch.logstashbridge.ingest.ConfigurationUtilsBridge;
1512
import org.elasticsearch.logstashbridge.ingest.IngestDocumentBridge;
1613
import org.elasticsearch.logstashbridge.ingest.ProcessorBridge;
@@ -31,8 +28,6 @@ public class PipelineProcessor implements ProcessorBridge {
3128
private final IngestPipelineResolver pipelineProvider;
3229
private final boolean ignoreMissingPipeline;
3330

34-
private static final Logger LOGGER = LogManager.getLogger(PipelineProcessor.class);
35-
3631
private PipelineProcessor(String tag,
3732
String description,
3833
TemplateScriptBridge.Factory pipelineTemplate,
@@ -90,12 +85,6 @@ public void execute(IngestDocumentBridge ingestDocument, BiConsumer<IngestDocume
9085
}
9186
}
9287

93-
// TODO: find a way to remove this method
94-
// it is due to StableBridgeAPI#unwrap() requirement
95-
@Override
96-
public Processor unwrap() {
97-
throw new RuntimeException("Unallowed operation.");
98-
}
9988

10089
public static class Factory implements ProcessorBridge.Factory {
10190

src/main/java/co/elastic/logstash/filters/elasticintegration/ingest/SetSecurityUserProcessor.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77
package co.elastic.logstash.filters.elasticintegration.ingest;
88

9-
import org.elasticsearch.ingest.Processor;
109
import org.elasticsearch.logstashbridge.ingest.IngestDocumentBridge;
1110
import org.elasticsearch.logstashbridge.ingest.ProcessorBridge;
1211

@@ -26,7 +25,7 @@ private SetSecurityUserProcessor(final String tag, final String description) {
2625

2726

2827
@Override
29-
public void execute(IngestDocumentBridge ingestDocumentBridge, BiConsumer<IngestDocumentBridge, Exception> biConsumer) throws Exception {
28+
public void execute(IngestDocumentBridge ingestDocumentBridge, BiConsumer<IngestDocumentBridge, Exception> biConsumer) {
3029
// within Logstash, the set_security_user processor is a no-op
3130
}
3231

@@ -50,13 +49,6 @@ public boolean isAsync() {
5049
return false;
5150
}
5251

53-
// TODO: find a way to remove this method
54-
// it is due to StableBridgeAPI#unwrap() requirement
55-
@Override
56-
public Processor unwrap() {
57-
return null;
58-
}
59-
6052
public static final class Factory implements ProcessorBridge.Factory {
6153

6254
@Override

0 commit comments

Comments
 (0)