gpt4 book ai didi

java - 如何使用apachecamel从elasticsearch获取所有条目?

转载 作者:行者123 更新时间:2023-12-02 03:19:22 25 4
gpt4 key购买 nike

假设我有这样的 elasticsearch 实例:

 from("direct:index")    .to("elasticsearch://local?operation=INDEX&indexName=twitter&
indexType=tweet");
我添加了 10 条推文,如何从 elasticsearch 获取该推文的所有列表?我尝试过这样的事情:

from("elasticsearch://local?operation=MULTIGET&indexName=twitter&    indexType=tweet").process(new MyProcessor())   .to("direct:somewhere")  
但它不起作用,你能帮我做到这一点吗?处理器中的数据是什么类型?

我需要使用 apache Camel DSL 获取所有推文的列表,你能帮我做到这一点吗?

最佳答案

只是猜测,但是 Camel Elastic页面显示 MULTIGET

Retrieves the specified indexes type's specified in MultigetRequest and returns a MultigetResponse object in the body

所以我想您必须在消息正文中提供一个 MultigetRequest 对象,然后在 Elastic 中执行搜索。

这意味着您不能通过 from(...) 直接将其用作 Consumer,但您必须使用 .to(...) 调用它code> 并确保消息包含正确的正文。

关于java - 如何使用apachecamel从elasticsearch获取所有条目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56937993/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com