如何使用luke打開elasticsearch索引?Elasticsearch和luke
我試着從3.5到4.8盧克,elasticsearch 1.1到1.2,似乎沒有任何工作。
似乎適用的唯一資源是http://rosssimpson.com/blog/2014/05/06/using-luke-with-elasticsearch/,不幸的是沒有工作。
如何使用luke打開elasticsearch索引?Elasticsearch和luke
我試着從3.5到4.8盧克,elasticsearch 1.1到1.2,似乎沒有任何工作。
似乎適用的唯一資源是http://rosssimpson.com/blog/2014/05/06/using-luke-with-elasticsearch/,不幸的是沒有工作。
盧克支持elasticsearch 1.5.0現在:https://github.com/DmitryKey/luke(從主人建立或使用https://github.com/DmitryKey/luke/releases/tag/luke-4.10.4-field-reconstruction)。
我還沒有與任何其他版本嘗試過,但似乎與盧克4.9和elasticsearch版本1.3.1工作(ElasticSearch 1.3.x中使用的Lucene 4.9的下面)
在命令行中執行:
git clone https://github.com/DmitryKey/luke.git
或簡單地下載luke-4.9.0版本的源代碼。 接下來,編輯的pom.xml文件,並添加以下依賴:
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>1.3.1</version>
</dependency>
在命令行再這樣做:
cd luke
mvn install
這應該創建一個名爲luke-文件的目標目錄with-deps.jar。 打開此文件中的任何檔案管理器和編輯文件META-INF /服務上http://rosssimpson.com/blog/2014/05/06/using-luke-with-elasticsearch/描述/ org.apache.lucene.codecs.PostingsFormat,並添加以下行
org.elasticsearch.index.codec.postingsformat.BloomFilterPostingsFormat
org.elasticsearch.index.codec.postingsformat.Elasticsearch090PostingsFormat
org.elasticsearch.search.suggest.completion.Completion090PostingsFormat
保存這一點,你應該能夠運行盧克使用luke.bat或luke.sh。 例如,您現在可以在/ indexname/0/index /處打開索引。 如果您的elasticsearch集羣中有多個分區(默認值爲5),則可能無法看到該集羣中的所有文檔,但只能看到其中的一部分。只有在index.number_of_shards設置爲1時,您才能看到所有文檔。
我成功地通過ElasticSearch 1.3.4(其使用Lucene 4.9.1)打開索引。我也按照Ross Simpson's blog中的說明操作,但沒有奏效。在pom.xml
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>1.3.4</version>
</dependency>
而且還設置了Lucene的版本(在我的情況4.9.1):正如他所說,我在pom.xml
添加ElasticSearch依賴(對我來說版本1.3.4)
<lucene.version>4.9.1</lucene.version>
我更新如下罐子META-INF/services/org.apache.lucene.codecs.PostingsFormat
:
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
到目前爲止,指令是一樣的,在博客文章。額外的步驟我帶的是更新META-INF/services/org.apache.lucene.codecs.Codec
添加的最後一行(打開一個名爲Lucene49編解碼器未找到索引時我得到一個例外):
org.apache.lucene.codecs.simpletext.SimpleTextCodec
org.apache.lucene.codecs.appending.AppendingCodec
org.apache.lucene.codecs.lucene49.Lucene49Codec