How to execute Lucene query inside Elasticsearch

Hey there,

I'm writing an Elasticsearch plugin. Can someone direct me to the right place how to execute a Lucene query in the Query Builder or Rescoring part from a plugin?

The reason for a Lucene is because I want to apply ML data model in the shard for the number of documents filtered by a query. I know there are existing plugins for that but none of them really works in my business case.

Is there any way to access Lucene from custom query builder (from a plugin):

public class MyCustomQueryPlugin extends Plugin implements SearchPlugin {	
   @Override
   public List<QuerySpec<?>> getQueries() {

       return singletonList(
               new QuerySpec<>(MyCustomQueryBuilder.NAME, MyCustomQueryBuilder::new, MyCustomQueryBuilder::fromXContent)
       );
   }
}

Registering your own query builder means you will have a custom query type you can run, where the Query produced by the query builder is a Lucene construct. Anything should be possible from there. Can you further describe what you are trying to accomplish?

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