Elasticsearch-如何将脚本存储在config / scripts目录中 [英] Elasticsearch - how to store scripts in config/scripts directory

查看:183
本文介绍了Elasticsearch-如何将脚本存储在config / scripts目录中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 config / scripts 目录中的脚本。 Elasticsearch docs 此处说:

I'm trying to experiment with using scripts in the config/scripts directory. The Elasticsearch docs here say this:


将脚本的内容另存为群集中每个数据节点上名为config / scripts / my_script.groovy的文件:

Save the contents of the script as a file called config/scripts/my_script.groovy on every data node in the cluster:

这似乎很简单,但恐怕我不明白如何在每个数据节点上精确地放置一个groovy文件在集群中。通常是通过命令行以某种方式完成此操作,还是可以通过手动移动groovy文件(例如在OSX的Finder中)完成此操作?我有一个测试索引,但是当我查看节点上的文件结构时,我很困惑将groovy文件放在何处。

This seems like it's probably really easy, but I'm afraid I don't understand how exactly to put a groovy file "on every data node in the cluster". Would this normally be done through the command line somehow, or can it be done by manually moving the groovy file (in Finder on OSX for example)? I have a test index, but when I look at the file structure on the nodes I'm confused where to put the groovy file. Help, pretty please.

推荐答案

您只需将文件复制到每台运行Elasticsearch的服务器上。如果您只是在计算机上运行elasticsearch,请转到已安装elasticsearch的文件夹,然后将文件复制到其中的config / scripts中(可能必须先创建该文件夹)。没关系,文件如何到达。

You just need to copy the file to each server running elasticsearch. If you're just running elasticsearch on your computer then go to the folder you've installed elasticsearch into and add copy the file into config/scripts in there (you may have to create the folder first). Doesn't matter how the file gets there.

您应该在日志中看到一个条目(如果在前台运行,则应该在控制台中),其中

You should see an entry in the logs (or the console if you are running in the foreground) along the lines of

compiling script file [/path/to/elasticsearch/config/scripts/my_script.groovy

这不会立即显示-默认情况下,elasticsearch每60秒检查一次新的/更新的脚本(您可以使用 watcher.interval 设置)

This won't show up straightaway - by default elasticsearch checks for new/updated scripts every 60 seconds (you can change this with the watcher.interval setting)

这篇关于Elasticsearch-如何将脚本存储在config / scripts目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆