How to access the underlying Lucene index in ElasticSearch custom handler?


(Maciej Buczek) #1

Cross-posted from http://stackoverflow.com/questions/30170098/how-to-access-the-underlying-lucene-index-in-elasticsearch-custom-handler due to a lack of replies.

My current project involves search over highly customised Solr
indices. It turns out that the best way to query those is to use the
Lucene API.
In Solr, I can access the underlying Lucene index using:

public void process(ResponseBuilder responseBuilder) throws IOException {
    SolrIndexSearcher sir = responseBuilder.req.getSearcher();
    BooleanQuery bq = new BooleanQuery();
    Query tq = new TermQuery(new Term("content", "test"));
    bq.add(tq, BooleanClause.Occur.MUST);
    TopDocs td = sir.search(bq, 20);
    }

Now, ElasticSearch seems to hide the Lucene functionalities. Is there
a way to expose the Lucene index at ES query handler level, or to query
it similarly to the example above (i.e. direct querying over index
fields) using the ES API?


(Mark Walkom) #2

We don't expose things down to that layer, as far as I understand.


(Jörg Prante) #3

You can re-implement Lucene functionalities in an Elasticsearch plugin, if the functionality is really missing. On shard level, much of these can be translated straightforward.

Due to the close relationship of Lucene and Elasticsearch teams, there are many efforts to expose Lucene API to Elasticsearch core features. It would be feasible to study how your custom features can be implemented the "Elastic way" - due to the distributed nature of Elasticsearch, there are important extra efforts to consider, like cluster, shard, and node management.


(system) #4