While the same code needs to be used in different environments, how can I make the host and port parameterized and use environment variables. something like " host => [${HOST}] " in logstash.
If you want to re-use the same code in many differents watch you have to use stored sripts fields
POST _scripts/dat_super_script
{
"script": {
"lang": "painless",
"code": """def my_data = ["DATA1","DATA2","DATA3"]; ctx.vars.my_data=my_data;
--- do whatever you want there---
"""
}
}
This script will create an array and add this array to the execution context and you can use it as condition validator or transform or just logging action , to just add data to the execution context
another possibility is to reuse the same watches (same input, same action ,same condition), but change the metadata field and access those. This way you could have scripts creating the watches on your deployment mechanism.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.