@@ -1146,11 +1146,9 @@ public MsearchRequest searchMsearchRequest(
1146
1146
}
1147
1147
1148
1148
if (!isEmpty (query .getIndicesBoost ())) {
1149
- Map <String , Double > boosts = new LinkedHashMap <>();
1150
- query .getIndicesBoost ()
1151
- .forEach (indexBoost -> boosts .put (indexBoost .getIndexName (), (double ) indexBoost .getBoost ()));
1152
- // noinspection unchecked
1153
- bb .indicesBoost (boosts );
1149
+ bb .indicesBoost (query .getIndicesBoost ().stream ()
1150
+ .map (indexBoost -> Map .of (indexBoost .getIndexName (), Double .valueOf (indexBoost .getBoost ())))
1151
+ .collect (Collectors .toList ()));
1154
1152
}
1155
1153
1156
1154
if (query instanceof NativeQuery ) {
@@ -1301,11 +1299,9 @@ private <T> void prepareSearchRequest(Query query, @Nullable Class<T> clazz, Ind
1301
1299
}
1302
1300
1303
1301
if (!isEmpty (query .getIndicesBoost ())) {
1304
- Map <String , Double > boosts = new LinkedHashMap <>();
1305
- query .getIndicesBoost ()
1306
- .forEach (indexBoost -> boosts .put (indexBoost .getIndexName (), (double ) indexBoost .getBoost ()));
1307
- // noinspection unchecked
1308
- builder .indicesBoost (boosts );
1302
+ builder .indicesBoost (query .getIndicesBoost ().stream ()
1303
+ .map (indexBoost -> Map .of (indexBoost .getIndexName (), Double .valueOf (indexBoost .getBoost ())))
1304
+ .collect (Collectors .toList ()));
1309
1305
}
1310
1306
}
1311
1307
0 commit comments