@@ -1246,11 +1246,9 @@ public MsearchRequest searchMsearchRequest(
12461246 }
12471247
12481248 if (!isEmpty (query .getIndicesBoost ())) {
1249- Map <String , Double > boosts = new LinkedHashMap <>();
1250- query .getIndicesBoost ()
1251- .forEach (indexBoost -> boosts .put (indexBoost .getIndexName (), (double ) indexBoost .getBoost ()));
1252- // noinspection unchecked
1253- bb .indicesBoost (boosts );
1249+ bb .indicesBoost (query .getIndicesBoost ().stream ()
1250+ .map (indexBoost -> Map .of (indexBoost .getIndexName (), Double .valueOf (indexBoost .getBoost ())))
1251+ .collect (Collectors .toList ()));
12541252 }
12551253
12561254 query .getScriptedFields ().forEach (scriptedField -> bb .scriptFields (scriptedField .getFieldName (),
@@ -1412,11 +1410,9 @@ private <T> void prepareSearchRequest(Query query, @Nullable String routing, @Nu
14121410 }
14131411
14141412 if (!isEmpty (query .getIndicesBoost ())) {
1415- Map <String , Double > boosts = new LinkedHashMap <>();
1416- query .getIndicesBoost ()
1417- .forEach (indexBoost -> boosts .put (indexBoost .getIndexName (), (double ) indexBoost .getBoost ()));
1418- // noinspection unchecked
1419- builder .indicesBoost (boosts );
1413+ builder .indicesBoost (query .getIndicesBoost ().stream ()
1414+ .map (indexBoost -> Map .of (indexBoost .getIndexName (), Double .valueOf (indexBoost .getBoost ())))
1415+ .collect (Collectors .toList ()));
14201416 }
14211417
14221418 if (!isEmpty (query .getDocValueFields ())) {
0 commit comments