I'm trying to perform a groovy script using Java API:
AggregationBuilders
.terms(this.getName())
.field(this.getName())
.script(
new Script(
"year",
ScriptType.FILE,
"groovy",
ImmutableMap.of("name", this.getName())
)
);
I'm running an elasticsearch instance using a custom made docker image. This is the DockerFile:
FROM elasticsearch:2.4
MAINTAINER me
COPY ./year.groovy /etc/elasticsearch/scripts
As you can see I'm providing my script file COPYing the file in /etc/elaticsearch/scripts.
I've checked out on /etc/elasticsearch/scripts:
#docker exec -it es ls /etc/elasticsearch/scripts -l
-rw-r--r--. 1 root root 70 Oct 6 07:24 year.groovy
However, when the java code is reached, it's telling me:
Unable to find on disk file script [year] using lang [groovy];
Any ideas?
inlinescripts, isn't it?script.file: truescript.fileis set totrueby default. See elastic.co/guide/en/elasticsearch/reference/current/…