Skip to content

Commit 1544ed7

Browse files
committed
Performance fix. Reduce deprecation calls for the same bulk request
1 parent 033e67f commit 1544ed7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ public BulkRequest add(BytesReference data, @Nullable String defaultIndex, @Null
366366
int from = 0;
367367
int length = data.length();
368368
byte marker = xContent.streamSeparator();
369+
boolean typesDeprecationLogged = false;
369370
while (true) {
370371
int nextMarker = findNextMarker(marker, from, data, length);
371372
if (nextMarker == -1) {
@@ -427,7 +428,10 @@ public BulkRequest add(BytesReference data, @Nullable String defaultIndex, @Null
427428
}
428429
index = parser.text();
429430
} else if (TYPE.match(currentFieldName, parser.getDeprecationHandler())) {
430-
deprecationLogger.deprecatedAndMaybeLog("bulk_with_types", RestBulkAction.TYPES_DEPRECATION_MESSAGE);
431+
if (typesDeprecationLogged == false) {
432+
deprecationLogger.deprecatedAndMaybeLog("bulk_with_types", RestBulkAction.TYPES_DEPRECATION_MESSAGE);
433+
typesDeprecationLogged = true;
434+
}
431435
type = parser.text();
432436
} else if (ID.match(currentFieldName, parser.getDeprecationHandler())) {
433437
id = parser.text();

0 commit comments

Comments
 (0)