使用 Camel 索引到弹性搜索中的数据,但在 Kibana 或本地主机中看不到:9200



我正在尝试使用Apache Camel插入一些针对某些ID的数据。我插入了依赖性:

<dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-elasticsearch</artifactId>
</dependency>

我使用的是jsonobject如下:

{
"indexId" : "someId",
"messages" : {"message1" : "data1", "message2":"data2"}
}

和数据正在使用:

插入
<to id="elastic_search_camel"
                uri="elasticsearch://local?operation=INDEX&amp;indexName=messages&amp;indexType=message" />

我还可以使用操作= get_by_id将数据打印在控制台上。但是我无法在Kibana或Localhost中看到索引/数据:9200。

有人可以帮助我吗?预先感谢。

您需要检查索引是否存在 - 您可以运行

获取es-url:9200/_cat/indices/messages*

并确保索引存在。如果索引不存在,则索引存在问题 - 您要么需要提前创建索引,要么在Elasticsearch和Camel Producer中寻找其失败的例外。

确保按预期对数据进行索引后,您可以进入Kibana->设置 -> index-Patterns,并为这些新索引模式添加索引模式。之后,您将能够在Kibana中看到数据

我正在使用Apache Camel连接到Elasticsearch Server。骆驼创建了自己的Elasticsearch群集,因此它没有连接到我的Curether -Crounty运行服务器。要停止这种特定的行为,您需要在创建URI时明确指定IP和端口:

<to id="elastic_search_camel"
                uri="elasticsearch://<clusterName>?operation=INDEX&amp;indexName=messages&amp;indexType=doc&amp;ip=x.x.x.x&amp;port=9300" />

注意:参数TransportAddresses也可以用于指定IP:端口格式的列表。查看http://camel.apache.org/elasticsearch.html有关此的详细信息。

在config/elasticsearch.yml文件中指定相同的内容:

http.port: 9200
network.host: x.x.x.x
cluster.name: <clusterName>
network.bind_host: 0

Maven中的依赖性:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-elasticsearch</artifactId>
</dependency>
<dependency>
    <groupId>net.java.dev.jna</groupId>
    <artifactId>jna</artifactId>
    <version>4.1.0</version>
</dependency>

在弹性搜索的选择中,也可以使用Elasticsearch-Rest。可以将路线指定为:

<to id="elastic_search_camel"
            uri="elasticsearch-rest://<clusterName>?operation=INDEX&amp;indexName=messages&amp;indexType=doc&amp;hostAddresses=x.x.x.x:9200" />

文档可用:弹性搜索REST

Maven dependencies : 
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-elasticsearch-rest</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-elasticsearch-rest-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna</artifactId>
            <version>4.1.0</version>
        </dependency>

最新更新