Skip to content

Commit

Permalink
document_id_field to document_id since deprecated
Browse files Browse the repository at this point in the history
Signed-off-by: Maxwell Brown <[email protected]>
  • Loading branch information
Galactus22625 committed Dec 19, 2024
1 parent be265c0 commit 5f9b9f6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ public void testOutputCustomIndex() throws IOException, InterruptedException {
final String testId = "foo";
final List<Record<Event>> testRecords = Collections.singletonList(jsonStringToRecord(generateCustomRecordJson(testIdField, testId)));
final OpenSearchSinkConfig openSearchSinkConfig = generateOpenSearchSinkConfig(null, testIndexAlias, testTemplateFile);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID_FIELD, testIdField);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID, testIdField);
final OpenSearchSink sink = createObjectUnderTest(openSearchSinkConfig, true);
sink.output(testRecords);
final List<Map<String, Object>> retSources = getSearchResponseDocSources(testIndexAlias);
Expand All @@ -850,7 +850,7 @@ public void testOpenSearchBulkActionsCreate() throws IOException, InterruptedExc
final String testId = "foo";
final List<Record<Event>> testRecords = Collections.singletonList(jsonStringToRecord(generateCustomRecordJson(testIdField, testId)));
final OpenSearchSinkConfig openSearchSinkConfig = generateOpenSearchSinkConfig(null, testIndexAlias, testTemplateFile);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID_FIELD, testIdField);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID, testIdField);
pluginSetting.getSettings().put(IndexConfiguration.ACTION, OpenSearchBulkActions.CREATE.toString());
final OpenSearchSink sink = createObjectUnderTest(openSearchSinkConfig, true);
sink.output(testRecords);
Expand All @@ -877,7 +877,7 @@ public void testOpenSearchBulkActionsCreateWithExpression() throws IOException,
final String testId = "foo";
final List<Record<Event>> testRecords = Collections.singletonList(jsonStringToRecord(generateCustomRecordJson(testIdField, testId)));
final OpenSearchSinkConfig openSearchSinkConfig = generateOpenSearchSinkConfig(null, testIndexAlias, testTemplateFile);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID_FIELD, testIdField);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID, testIdField);
Event event = (Event) testRecords.get(0).getData();
event.getMetadata().setAttribute("action", "create");
final String actionFormatExpression = "${getMetadata(\"action\")}";
Expand Down Expand Up @@ -910,7 +910,7 @@ public void testOpenSearchBulkActionsCreateWithInvalidExpression() throws IOExce
final String testId = "foo";
final List<Record<Event>> testRecords = Collections.singletonList(jsonStringToRecord(generateCustomRecordJson(testIdField, testId)));
final OpenSearchSinkConfig openSearchSinkConfig = generateOpenSearchSinkConfig(null, testIndexAlias, testTemplateFile);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID_FIELD, testIdField);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID, testIdField);
Event event = (Event) testRecords.get(0).getData();
event.getMetadata().setAttribute("action", "unknown");
final String actionFormatExpression = "${getMetadata(\"action\")}";
Expand All @@ -936,7 +936,7 @@ public void testBulkActionCreateWithActions() throws IOException, InterruptedExc
final List<Record<Event>> testRecords = Collections.singletonList(jsonStringToRecord(generateCustomRecordJson(testIdField, testId)));

final OpenSearchSinkConfig openSearchSinkConfig = generateOpenSearchSinkConfig(null, testIndexAlias, testTemplateFile);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID_FIELD, testIdField);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID, testIdField);
List<Map<String, Object>> aList = new ArrayList<>();
Map<String, Object> aMap = new HashMap<>();
aMap.put("type", OpenSearchBulkActions.CREATE.toString());
Expand Down Expand Up @@ -969,7 +969,7 @@ public void testBulkActionUpdateWithActions() throws IOException, InterruptedExc
List<Record<Event>> testRecords = Collections.singletonList(jsonStringToRecord(generateCustomRecordJson2(testIdField, testId, "name", "value1")));

final OpenSearchSinkConfig openSearchSinkConfig = generateOpenSearchSinkConfig(null, testIndexAlias, testTemplateFile);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID_FIELD, testIdField);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID, testIdField);
List<Map<String, Object>> aList = new ArrayList<>();
Map<String, Object> aMap = new HashMap<>();
aMap.put("type", OpenSearchBulkActions.CREATE.toString());
Expand Down Expand Up @@ -1027,7 +1027,7 @@ public void testBulkActionUpdateWithDocumentRootKey() throws IOException, Interr
final OpenSearchSinkConfig openSearchSinkConfig = generateOpenSearchSinkConfig(null, testIndexAlias, testTemplateFile);

pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ROOT_KEY, documentRootKey);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID_FIELD, testIdField);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID, testIdField);
List<Map<String, Object>> aList = new ArrayList<>();
Map<String, Object> actionMap = new HashMap<>();
actionMap.put("type", OpenSearchBulkActions.CREATE.toString());
Expand Down Expand Up @@ -1088,7 +1088,7 @@ public void testBulkActionUpsertWithActionsAndNoCreate() throws IOException, Int
aList.add(actionMap);

final OpenSearchSinkConfig openSearchSinkConfig = generateOpenSearchSinkConfig(null, testIndexAlias, testTemplateFile);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID_FIELD, testIdField);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID, testIdField);
pluginSetting.getSettings().put(IndexConfiguration.ACTIONS, aList);
OpenSearchSink sink = createObjectUnderTest(openSearchSinkConfig, true);

Expand All @@ -1114,7 +1114,7 @@ public void testBulkActionUpsertWithActions() throws IOException, InterruptedExc
List<Record<Event>> testRecords = Collections.singletonList(jsonStringToRecord(generateCustomRecordJson2(testIdField, testId, "name", "value1")));

final OpenSearchSinkConfig openSearchSinkConfig = generateOpenSearchSinkConfig(null, testIndexAlias, testTemplateFile);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID_FIELD, testIdField);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID, testIdField);
List<Map<String, Object>> aList = new ArrayList<>();
Map<String, Object> aMap = new HashMap<>();
aMap.put("type", OpenSearchBulkActions.CREATE.toString());
Expand Down Expand Up @@ -1162,7 +1162,7 @@ public void testBulkActionUpsertWithoutCreate() throws IOException, InterruptedE
final String testId = "foo";
List<Record<Event>> testRecords = Collections.singletonList(jsonStringToRecord(generateCustomRecordJson3(testIdField, testId, "name", "value1", "newKey", "newValue")));
final OpenSearchSinkConfig openSearchSinkConfig = generateOpenSearchSinkConfig(null, testIndexAlias, testTemplateFile);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID_FIELD, testIdField);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID, testIdField);
List<Map<String, Object>> aList = new ArrayList<>();
Map<String, Object> aMap = new HashMap<>();
aMap.put("type", OpenSearchBulkActions.UPSERT.toString());
Expand Down Expand Up @@ -1198,7 +1198,7 @@ public void testBulkActionDeleteWithActions() throws IOException, InterruptedExc
List<Record<Event>> testRecords = Collections.singletonList(jsonStringToRecord(generateCustomRecordJson(testIdField, testId)));

final OpenSearchSinkConfig openSearchSinkConfig = generateOpenSearchSinkConfig(null, testIndexAlias, testTemplateFile);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID_FIELD, testIdField);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID, testIdField);
List<Map<String, Object>> aList = new ArrayList<>();
Map<String, Object> aMap = new HashMap<>();
aMap.put("type", OpenSearchBulkActions.DELETE.toString());
Expand Down Expand Up @@ -1308,7 +1308,7 @@ public void testOpenSearchDocumentId(final String testDocumentIdField) throws IO
final List<Record<Event>> testRecords = Collections.singletonList(new Record<>(testEvent));

final OpenSearchSinkConfig openSearchSinkConfig = generateOpenSearchSinkConfig(null, testIndexAlias, null);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID_FIELD, testDocumentIdField);
pluginSetting.getSettings().put(IndexConfiguration.DOCUMENT_ID, testDocumentIdField);
final OpenSearchSink sink = createObjectUnderTest(openSearchSinkConfig, true);
sink.output(testRecords);

Expand Down Expand Up @@ -1622,7 +1622,7 @@ public void testOutputManagementDisabled() throws IOException, InterruptedExcept
final Map<String, Object> metadata = initializeConfigurationMetadata(null, testIndexAlias, null);
metadata.put(IndexConfiguration.INDEX_TYPE, IndexType.MANAGEMENT_DISABLED.getValue());
metadata.put(AUTHENTICATION, Map.of(USERNAME, username, PASSWORD, password));
metadata.put(IndexConfiguration.DOCUMENT_ID_FIELD, testIdField);
metadata.put(IndexConfiguration.DOCUMENT_ID, testIdField);
final OpenSearchSinkConfig openSearchSinkConfig = generateOpenSearchSinkConfigByMetadata(metadata);
final OpenSearchSink sink = createObjectUnderTest(openSearchSinkConfig, true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public class IndexConfiguration {
public static final String ESTIMATE_BULK_SIZE_USING_COMPRESSION = "estimate_bulk_size_using_compression";
public static final String MAX_LOCAL_COMPRESSIONS_FOR_ESTIMATION = "max_local_compressions_for_estimation";
public static final String FLUSH_TIMEOUT = "flush_timeout";
public static final String DOCUMENT_ID_FIELD = "document_id_field";
public static final String DOCUMENT_ID = "document_id";
public static final String ROUTING_FIELD = "routing_field";
public static final String ROUTING = "routing";
Expand Down

0 comments on commit 5f9b9f6

Please sign in to comment.