p4paul
(Paul Allen)
August 13, 2024, 10:03am
1
It seems that co.elastic.clients.elasticsearch._types.InlineScript has been removed from 8.15.0 (exists in 8.14.3)?
Is this intended? If so how do I migrate existing code?
InlineScript inlineScript = InlineScript.of(s -> s
.source(MY_PLUGIN)
.lang("langX")
.params("paramX", jsonData));
Last seen...
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package co.elastic.clients.elasticsearch._types;
This file has been truncated. show original
Hello,
Until someone more familiar with the Java Elasticsearch client answers, I can confirm that InlineScript
got renamed to Script
in the Elasticsearch specification to fix an issue with the Go client: [Proposal] Transform script into a container by Anaethelion · Pull Request #2708 · elastic/elasticsearch-specification · GitHub . (The Java Elasticsearch client is generated from that specification.)
I believe renaming InlineScript
to Script
is all that is needed in your code snippet, as source
, lang
and params
are part of the Script
class now .
Sorry for the hassle.
p4paul
(Paul Allen)
August 13, 2024, 10:30am
3
I'm not sure Script and InlineScript are the same, but will try it out...
I removed the Script.of(...) and use the old InlineScript declaration.
InlineScript inlineScript = InlineScript.of(s -> s
.source(MY_PLUGIN)
.lang("langX")
.params("paramX", jsonData));
Script script = Script.of(ss -> ss.inline(inlineScript));
return QueryBuilders.script(q -> q.script(script));
to
Script script = Script.of(s -> s
.source(MY_PLUGIN)
.lang("langX")
.params("paramX", jsonData));
return QueryBuilders.script(q -> q.script(script));
I now see errors on the range
QueryBuilder...
field(...)
does not exist anymore?
Query revTerm = QueryBuilders.range(r -> r.field("rev").to(String.valueOf(rev)));
p4paul
(Paul Allen)
August 13, 2024, 10:31am
4
Perhaps it is now wrapped in a term?
Query revTerm = QueryBuilders.range(r -> r.term(t -> t.field("rev").to(String.valueOf(rev))));
ltrotta
(Laura Trotta)
August 20, 2024, 9:00am
5
Hello, first of all I can confirm that the old classes InlineScript and StoredScript were simplified to just Script: these were client specific classes that don't exist in the server, so we decided to make these more coherent with the server structure. RangeQuery has been changed to make it possible to specify the type of the query and avoid passing JsonData as argument, you can find an example of the new usage in the release highlights .
p4paul
(Paul Allen)
August 20, 2024, 10:40am
6
Thank you for the clarification and link to the release notes. I need to fully test the changes to range queries, but wrapping with a term seemed to work.