Override class for plugin in ElasticSearch

I'm working on ElasticSearch Plugin to retrieve total frequency of searched term. I've already created maven project and successfully deployed my test plugin into ElasticSearch but I have no idea how to write override function to perform this task.

I have found out that there is a getTotalTermFreq() function in org.elasticsearch.index.similarity.ScriptedSimilarity.Term class/object which returns the total number of occurrences of this term in the index, or -1 if this statistic is not available. But, I have no idea how to use this function in plugin!

I already tried looking in to other open source plugins available on github but couldn't find anything useful or I can say I didn't understand that much because of my no-experience in Java.

Can someone please help?

Thanks in advance.

It sounds like you want to implement your own Similarity. Try looking at Plugin.onIndexModule and then add a SimilarityProvider.

@rjernst
Thank you so much for your response and time.

I'm sorry, I can not understand how Plugin.onIndexModule is useful in this case as I want to retrieve term count when we execute a search query.

I'm very confused about all this!!! I want to implement this asap because I have a conference with about this feature on Friday. So, If it is not too much to ask and doesn't bother you, can you please write only a override class with long function which returns the term count in index? It would be very helpful for me!

Thanks,
Kishan

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.