-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[5.1] Returned values of runtime fields are null for every field except the last one #2727
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
Comments
I cannot reproduce that. I just added this test to
and no matter in which order I add the values in addFields, it works. The entity is defined as:
the method creating the runtime fields:
The request body sent to elElasticsearch:
the response:
|
Just had another look, this is a bug in the 5.1 branch, for the upcoming 5.2 version this was fixed with #2663 |
I see you added this to the 5.1.6 milestone, does that mean the fix will be part of that release? |
@shahzebklp yes |
I am adding runtime fields to my NativeQuery object like this:
When I do the query I can see in my debugger that both
fields
andruntimeFields
lists are populated just like I expect them to be in the query. However, when I get the search result only the last field's, i.e.field2
, value is non-null – the rest are null. If I change the order of the last line to bequery.addFields(field2, field1)
, then onlyfield1
's value is non-null.This started happening after upgrading to Spring Boot 3 and the new client libraries
I am also using
import org.springframework.data.elasticsearch.core.ElasticsearchOperations
for doing the search.I am on Spring Boot version 3.1.0 and spring-data-elasticsearch 5.1.0.
At this point I am suspecting something in the spring api is behaving differently than what it used to in Spring Boot 2.x. I have tested this for both SB2 and SB3 and Elasticsearch 7.17.7 and 8.10.3, and this issue is only showing up in SB3.
The text was updated successfully, but these errors were encountered: