I’m trying to bulk index into my elastic as a service, using this code:
<code> List<BulkOperation> listIndexOperations = productionList.stream()
.map(production -> BulkOperation.of(bulkOpBuilder -> bulkOpBuilder
.index(indexOpBuilder -> indexOpBuilder
.id(production.getId().toString())
.document(production)
)
))
.collect(Collectors.toList());
BulkRequest bulkRequest = BulkRequest.of(buckBuilder -> buckBuilder
.index(indexName)
.operations(listIndexOperations)
);
getElasticsearchClient().bulk(bulkRequest);
</code>
<code> List<BulkOperation> listIndexOperations = productionList.stream()
.map(production -> BulkOperation.of(bulkOpBuilder -> bulkOpBuilder
.index(indexOpBuilder -> indexOpBuilder
.id(production.getId().toString())
.document(production)
)
))
.collect(Collectors.toList());
BulkRequest bulkRequest = BulkRequest.of(buckBuilder -> buckBuilder
.index(indexName)
.operations(listIndexOperations)
);
getElasticsearchClient().bulk(bulkRequest);
</code>
List<BulkOperation> listIndexOperations = productionList.stream()
.map(production -> BulkOperation.of(bulkOpBuilder -> bulkOpBuilder
.index(indexOpBuilder -> indexOpBuilder
.id(production.getId().toString())
.document(production)
)
))
.collect(Collectors.toList());
BulkRequest bulkRequest = BulkRequest.of(buckBuilder -> buckBuilder
.index(indexName)
.operations(listIndexOperations)
);
getElasticsearchClient().bulk(bulkRequest);
It works just fine, when I deploy the app in k8s and run it, BUT when I try to run it from my local env (windows), I get the error:
<code>"type":"illegal_argument_exception","reason":"Malformed action/metadata line [3], expected START_OBJECT but found [VALUE_STRING]
</code>
<code>"type":"illegal_argument_exception","reason":"Malformed action/metadata line [3], expected START_OBJECT but found [VALUE_STRING]
</code>
"type":"illegal_argument_exception","reason":"Malformed action/metadata line [3], expected START_OBJECT but found [VALUE_STRING]
On the other hand indexing one element works fine in both cases, using that:
<code> getElasticsearchClient().index(indexReqBuilder -> indexReqBuilder.index(getAliasName())
.id(String.valueOf(productionToIndex.getId()))
.document(productionToIndex));
</code>
<code> getElasticsearchClient().index(indexReqBuilder -> indexReqBuilder.index(getAliasName())
.id(String.valueOf(productionToIndex.getId()))
.document(productionToIndex));
</code>
getElasticsearchClient().index(indexReqBuilder -> indexReqBuilder.index(getAliasName())
.id(String.valueOf(productionToIndex.getId()))
.document(productionToIndex));
Any idea why the bulk index doesn’t work from my local?