-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spring-data-elasticsearch:4.4.10 IndicesBoost error #2598
Comments
You are using the new client, what version is the server? If it is an Elasticsearch 8 server, do you set the compatibility headers? 4.4.x is out of maintenance now, can you try this with the current version (5.1) |
elasticsearch version:7.17.8 I upgraded my dependencies: I got the same result. if (!isEmpty(query.getIndicesBoost())) {
Map<String, Double> boosts = new LinkedHashMap<>();
query.getIndicesBoost()
.forEach(indexBoost -> boosts.put(indexBoost.getIndexName(), (double) indexBoost.getBoost()));
// noinspection unchecked
builder.indicesBoost(boosts);
} |
what do you mean with that, where do you change? |
I got the correct result after making the modifications like this. // line 1414
if (!isEmpty(query.getIndicesBoost())) {
List<Map<String, Double>> boosts = query.getIndicesBoost().stream()
.map(indexBoost -> Map.of(indexBoost.getIndexName(), (double) indexBoost.getBoost()))
.collect(Collectors.toList());
// noinspection unchecked
builder.indicesBoost(boosts);
} |
Just had a closer look at the Elasticsearch client and the API definition. So it seems that the we need to send an array of objects that just have one property (index name) and value. I thought that the client would send the entries from the map as an array of such objects, but here the So switching from one Map with many values to a list of maps with one value each is correct. Thanks for finding that. I'll fix that later |
spring-data-elasticsearch:4.4.10
Received exception
Is my method incorrect?
There seems to be an error here:org.springframework.data.elasticsearch.client.elc.RequestConverter
The text was updated successfully, but these errors were encountered: