6

How can I open an elasticsearch index with luke?

I tried luke from 3.5 to 4.8, with elasticsearch 1.1 to 1.2 and nothing seems to work.

The only resource that seemed to apply was http://rosssimpson.com/blog/2014/05/06/using-luke-with-elasticsearch/ that unfortunately did not work.

yannisf
  • 6,016
  • 9
  • 39
  • 61

3 Answers3

1

I haven't tried it with any other versions but it seems to work with luke 4.9 and elasticsearch version 1.3.1 (ElasticSearch 1.3.x uses Lucene 4.9 underneath)

On the command line do:

git clone https://github.com/DmitryKey/luke.git

or simply download the sourcecode for the luke-4.9.0 release. Next, edit the pom.xml file and add the following dependency:

<dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>1.3.1</version>
</dependency>

On the commandline again do:

cd luke
mvn install

This should create a target directory with a file called luke-with-deps.jar. Open this file in any archive manager and edit the file META-INF/services/org.apache.lucene.codecs.PostingsFormat as described on http://rosssimpson.com/blog/2014/05/06/using-luke-with-elasticsearch/ and add the following lines

org.elasticsearch.index.codec.postingsformat.BloomFilterPostingsFormat
org.elasticsearch.index.codec.postingsformat.Elasticsearch090PostingsFormat
org.elasticsearch.search.suggest.completion.Completion090PostingsFormat

save this and you should be able to run luke using luke.bat or luke.sh. Now you are able to open the index at /indexname/0/index/ for example. If you have multiple shards in your elasticsearch cluster (default is 5), you may not see all documents in that cluster, but only a part of it. Only if index.number_of_shards is set to 1, you should be able to see all documents.

1

I have succeeded in opening an index by ElasticSearch 1.3.4 (which uses Lucene 4.9.1 under the hood). I too followed the instructions in Ross Simpson's blog, but it did not work. As he says, I added the ElasticSearch dependency (in my case version 1.3.4) in pom.xml:

<dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>1.3.4</version>
</dependency>

And also set the Lucene version (in my case 4.9.1) in pom.xml:

<lucene.version>4.9.1</lucene.version>

I updated the META-INF/services/org.apache.lucene.codecs.PostingsFormat in the jar as below:

org.apache.lucene.codecs.lucene40.Lucene40PostingsFormat
org.apache.lucene.codecs.lucene41.Lucene41PostingsFormat
org.elasticsearch.index.codec.postingsformat.BloomFilterPostingsFormat
org.elasticsearch.index.codec.postingsformat.Elasticsearch090PostingsFormat
org.elasticsearch.search.suggest.completion.Completion090PostingsFormat

So far the instructions are the same as in the blog post. The additional step I took is to update META-INF/services/org.apache.lucene.codecs.Codec add the last line (I was getting an exception when opening the index that a codec named Lucene49 was not found):

org.apache.lucene.codecs.simpletext.SimpleTextCodec
org.apache.lucene.codecs.appending.AppendingCodec
org.apache.lucene.codecs.lucene49.Lucene49Codec
Markos Fragkakis
  • 7,499
  • 18
  • 65
  • 103
1

Luke supports elasticsearch 1.5.0 now: https://github.com/DmitryKey/luke (build from master or use https://github.com/DmitryKey/luke/releases/tag/luke-4.10.4-field-reconstruction).

D_K
  • 1,410
  • 12
  • 35