spring-data-elasticsearch icon indicating copy to clipboard operation
spring-data-elasticsearch copied to clipboard

Define the script in the @ScriptedField annotation

Open AntonLGVS opened this issue 3 years ago • 2 comments
trafficstars

How about integration of the @ScriptedField annotation and the ScriptedField/RuntimeField inside query factories? For example:

@ScriptedField(script = "doc['other'].value + 'text'")
private String field;

From my opinion, it is better to use the RuntimeField instead of the ScriptedField because it is part of the ElasticSearch library.

AntonLGVS avatar Dec 19 '21 19:12 AntonLGVS

runtime fields and scripted fields are different things. In Spring Data Elasticsearch scripted fields are currently only available via the NativeSearchQuery, this is something that we should change in the future, after the client switch. We then should introduce a ScriptedField in a Spring Data Elasticsearch package, not using an Elasticsearch class and only when building the concrete query, use this.

But not before we have changed or at least added the internal client implementation to the new Elasticsearch Client, which is what I am currently working on.

sothawo avatar Dec 20 '21 20:12 sothawo

Yes, many issue depend on the new ES client. Most issue can be blocked. Is there anything I can do to help you with your the new client?

AntonLGVS avatar Dec 21 '21 05:12 AntonLGVS