Fix IndicesBoost error.

Original Pull Request #2606
Closes #2598

(cherry picked from commit d9fd722bb6af81068fb9b723b77c60efddbf06d3)
This commit is contained in:
Peter-Josef Meisch 2023-06-27 22:26:10 +02:00
parent 3abe6d9c1b
commit 121b47e1be
No known key found for this signature in database
GPG Key ID: DE108246970C7708

View File

@ -1246,11 +1246,9 @@ class RequestConverter {
} }
if (!isEmpty(query.getIndicesBoost())) { if (!isEmpty(query.getIndicesBoost())) {
Map<String, Double> boosts = new LinkedHashMap<>(); bb.indicesBoost(query.getIndicesBoost().stream()
query.getIndicesBoost() .map(indexBoost -> Map.of(indexBoost.getIndexName(), Double.valueOf(indexBoost.getBoost())))
.forEach(indexBoost -> boosts.put(indexBoost.getIndexName(), (double) indexBoost.getBoost())); .collect(Collectors.toList()));
// noinspection unchecked
bb.indicesBoost(boosts);
} }
query.getScriptedFields().forEach(scriptedField -> bb.scriptFields(scriptedField.getFieldName(), query.getScriptedFields().forEach(scriptedField -> bb.scriptFields(scriptedField.getFieldName(),
@ -1412,11 +1410,9 @@ class RequestConverter {
} }
if (!isEmpty(query.getIndicesBoost())) { if (!isEmpty(query.getIndicesBoost())) {
Map<String, Double> boosts = new LinkedHashMap<>(); builder.indicesBoost(query.getIndicesBoost().stream()
query.getIndicesBoost() .map(indexBoost -> Map.of(indexBoost.getIndexName(), Double.valueOf(indexBoost.getBoost())))
.forEach(indexBoost -> boosts.put(indexBoost.getIndexName(), (double) indexBoost.getBoost())); .collect(Collectors.toList()));
// noinspection unchecked
builder.indicesBoost(boosts);
} }
if (!isEmpty(query.getDocValueFields())) { if (!isEmpty(query.getDocValueFields())) {