弹性搜索和骆驼集成 [英] elasticsearch and camel integration
问题描述
我正在尝试将骆驼与弹性搜索集成.在 applicationContext.xml 添加以下内容
I am trying to integrate camel with elasticsearch. In applicationContext.xml added the following
<route id="timer-to-console">
<from uri="timer://foo?fixedRate=true&period=10s"/>
<transform>
<simple>Hello Web Application, how are you?</simple>
</transform>
<to uri="stream:out"/>
<to uri="elasticsearch://local"/>
</route>
然后当我运行
mvn jetty:run
我得到以下内容
veryCounter=0, firedTime=Mon Apr 21 13:14:43 PDT 2014}
BodyType String
Body Hello Web Application, how are you?
]
Stacktrace
----------------------------------------------------------------------------------------
java.lang.IllegalArgumentException: operation is missing
at org.apache.camel.component.elasticsearch.ElasticsearchProducer.process(ElasticsearchProducer.java:54)
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
我的 elasticsearch 在本地运行,我使用的是 ES 1.1.1.
My elasticsearch is running locally, I am using ES 1.1.1.
我需要指定什么
elasticsearch://clusterName[?options]
谢谢,
推荐答案
快速浏览 Apache CamelElasticsearch Component 页面他们展示了以下示例:
From a quick glance at the Apache Camel Elasticsearch Component page they show the following example:
elasticsearch://local?operation=INDEX&indexName=twitter&indexType=tweet
elasticsearch://local?operation=INDEX&indexName=twitter&indexType=tweet
这会将索引(添加)到名为 twitter
的索引中,其类型为 tweet
.您可以为 indexName 和 indexType 使用任何您想要的值.
This would INDEX (add) into an index named twitter
with a type of tweet
. You can use whatever values you want for the indexName and indexType.
更新: 再次查看 Elasticsearch Camel Component 文档...我认为为了在 elasticsearch 连接中使用 local
作为服务器名称,您需要使用本地集群名称运行本地 Elasticsearch 实例.默认情况下,Elasticsearch 配置 (elasticsearch.yml) 设置为使用 elasticsearch
Update: Looking at the Elasticsearch Camel Component documentation again... I think in order to use local
as the server name in the elasticsearch connection, you would need to be running your local Elasticsearch instance with a clustername of local. By default Elasticsearch configuration (elasticsearch.yml) is setup to run with a clustername of elasticsearch
这篇关于弹性搜索和骆驼集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!