I am trying to follow the guide linked below for creating a WatchSource using WatchSourceBuilder following the instructions.
I have setup the Maven repository and through trial and error (looking at github repositories) I have learned that this documentation is not accurate and that i will also need the following jars in my pom.xml file:
[ERROR] Failed to execute goal on project : Could not resolve dependencies for project: Failure to find org.elasticsearch.plugin:x-pack-watcher:jar:6.5.4 in http://nexus-dev/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] DependencyResolutionException - Apache Maven - Apache Software Foundation
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
Without a license, you won't have the Watcher/Alerting plugin within Elasticsearch with which your code can interact. Watcher is a commercial feature. Are you building this for use with clusters that have a license?
Since 5.0, the WatcherClient class is packaged in the x-pack-transport artifact hosted on Elastic's maven repo as described in the Configuring X-Pack Java Clients documentation. In other words, it's not in Maven central.
Ok, a third thing: the transport client is deprecated and will not support the next major version of Elasticsearch (8.0). Moving the the high-level REST client is recommended...it also comes packaged with the Watcher classes. We have a migration guide to help with the migration
Gotcha, and apologies for reading your previous note as saying, "My company does not have a premium license"
First, we no longer build the x-pack-watcher artifact, which is why you're not finding it for v6.5.4. It's been replaced by x-pack-core.
However, there might be an issue with your specific version. See this GitHub issue detailing an bug with the x-pack-core Maven artifact. The fix was made in 6.6.1, so you'll likely need to bump up to that version, I'm afraid.
You can see all the watcher-related code in 6.6.1 here
EDIT:
should mention that you can verify that the watcher classes are all in that x-pack-core artifact by downloading it from our maven repo and grepping the contents:
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.