I have created a plugin for custom default scoring in elastic search.
I created a Json template that uses that plugin but as soon as I create an index that uses that template I get an error:
java.lang.IllegalArgumentException: Unknown Similarity type [new_default] for [default]
where, new_default is name of the new default similarity. I have tested the plugin on my local system using cURL commands and it works as expected i.e. I don't get the error above.
I add the template using this:
PutIndexTemplateResponse putResponse = .... // set the template via a Json
GetIndexTemplatesResponse getResponse = client.admin().indices().prepareGetTemplates().get();
assertNotNull(getResponse.getIndexTemplates());
assertThat(getResponse.getIndexTemplates(), hasSize(1));
Both the test cases pass. The template is for indices that start with new_.
And I create an index using createIndex("new_index")
I have not tried with 2.x, but you should not need to create a plugin for a
new similarity or function score. The code just needs to be deployed as a
jar in elasticsearch's classpath, with the proper naming conventions.
Perhaps there is a chicken-and-egg problem with templates? Can you try
without them?
Thanks for the reply.
After some debugging I noticed that there was an issue in TestCase only.
The test case was not extending ESIntegTestCase. When I did that, this error was not there any more!!
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.