Adding a custom similarity plugin at index and cluster level in elasticsearch 2.3

I'm attempting to build my own similarity plugin and use it for the basis of scoring on an index. I have a built similarity plugin that I've dropped in my elasticsearch libs folder. I am adding it to the libs folder because when I tried to add it via the ES_CLASSPATH, this error was given:

Error: Don't modify the classpath with ES_CLASSPATH. Best is to add
additional elements via the plugin mechanism, or if code must really be
added to the main classpath, add jars to lib/ (unsupported).

I restarted elasticsearch and attempted to create an index with this similarity plugin.

The reason I am seeing for the error is

{"error":{"root_cause":[{"type":"remote_transport_exception","reason":"[Autolycus][127.0.0.1:9301][indices:admin/create]"}],"type":"illegal_argument_exception","reason":"Unknown Similarity type [testingsimilarity] for [custom_similarity]"}

From all posts I have seen regarding this error, elasticsearch changed in 2.2 to not allow plugins to be deployed like this. So I also attempted to deploy it as the default similarity but the es node failed to start, due to
IllegalArgumentException[Unknown Similarity type [overlapsimilarity] for [default]];

Is there another method to deploy custom similarity plugins, either at the cluster level or index level?

Thanks in advance

1 Like