避免通过jdbc-river在弹性搜索上重建索引 [英] Avoid rebuilding index through jdbc-river on elasticsearch

查看:137
本文介绍了避免通过jdbc-river在弹性搜索上重建索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下内容:


ElasticSearch - v0.90.9

ElasticSearch – v0.90.9

用于MySQL的JDBC连接器 - v5.1.28

JDBC connector for MySQL – v5.1.28

ElasticSearch River - v2.3.1

ElasticSearch River – v2.3.1

我可以使用ElasticSearch构建和查询索引数据。上述版本安装在Ubuntu 12.04 LTS虚拟机上,ElasticSearch作为一种服务运行,在系统重启后自动启动。

I am able to build and query the indexed data using ElasticSearch. The above mentioned versions are installed on Ubuntu 12.04 LTS virtual machine and ElasticSearch runs as a service which starts automatically after a system reboot.

让我们说当没有索引我使用ElasticSearch River来构建一个新的索引,并发出一个PUT命令构建索引,该索引被构建并且一切正常。现在,当我关闭虚拟机并重新启动它时,问题是这个索引被重新重建。我觉得这很烦人,有没有办法阻止自动重建索引?

Let us say that when there are no indices and I use ElasticSearch River to build a new index and issue a PUT command to build index, the index is built and everything works fine. Now, the issue is this index is rebuilt again when I shutdown the virtual machine and restart it again. I find this annoying and is there a way to prevent automatic rebuild of index?

有没有ElasticSearch River或ElasticSearch设置,我应该注意防止自动索引重建?在我的情况下,这是导致重复的。

Is there something with ElasticSearch River or ElasticSearch settings that I should be aware of to prevent automatic index rebuild? In my case this is causing duplicates.

提前感谢

推荐答案

p>我发现停止重新建立索引的唯一方法是删除河流文件运行后。

The only way I have found to stop it re-indexing is to delete the river document after it has run.

但是,如果你所遇到的问题是文件是重复的,你需要做的是识别一个id字段。有两种方式可以这样做,要么导入带有标签为_id的字段的数据,要么在创建该索引的映射时识别一个id字段,该标识标识id字段,如下所示。

However, if the issue you have is that documents are duplicated, what you would need to do is identify an id field. There are two ways to do this, either import the data with a field labeled "_id" or by identifying an id field when you create the mapping for that index which identifies the id field like the example below.

PUT my_index
{
    "settings": {
        "number_of_shards": 1,
        "number_of_replicas": 3
    },
    "mappings": {
        "my_type": {
            "properties":{
                "field1": { "type": "string", "analyzer": "keyword" }
        },
        "_id": { "path": "field1" }
    }
}

这篇关于避免通过jdbc-river在弹性搜索上重建索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆