6

如何使用卢克打开弹性搜索索引?

我尝试了从 3.5 到 4.8 的卢克,使用 elasticsearch 1.1 到 1.2,但似乎没有任何效果。

唯一似乎适用的资源是http://rosssimpson.com/blog/2014/05/06/using-luke-with-elasticsearch/不幸的是没有用。

4

3 回答 3

1

我没有用任何其他版本尝试过,但它似乎适用于 luke 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/services/org.apache.lucene.codecs.PostingsFormat,如http://rosssimpson.com/blog/2014/05/06/using-luke-with中所述-elasticsearch/并添加以下行

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

保存这个,你应该可以使用luke.batluke.sh运行 luke 。例如,现在您可以在 / indexname /0/index/ 打开索引。如果您的 elasticsearch 集群中有多个分片(默认为 5 个),您可能无法看到该集群中的所有文档,而只能看到其中的一部分。仅当 index.number_of_shards 设置为 1 时,您应该能够看到所有文档。

于 2014-08-01T11:21:23.990 回答
1

我已经成功地通过 ElasticSearch 1.3.4(它使用 Lucene 4.9.1 在引擎盖下)打开了一个索引。我也按照罗斯辛普森博客中的说明进行操作,但没有奏效。正如他所说,我在pom.xml

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

并将 Lucene 版本(在我的情况下为 4.9.1)设置为pom.xml

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

我更新了META-INF/services/org.apache.lucene.codecs.PostingsFormatjar 中的内容,如下所示:

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
于 2014-10-15T07:10:13.667 回答
1

Luke 现在支持 elasticsearch 1.5.0:https ://github.com/DmitryKey/luke (从 master 构建或使用https://github.com/DmitryKey/luke/releases/tag/luke-4.10.4-field-reconstruction)。

于 2015-04-15T19:48:06.553 回答