Red Hat Training

A Red Hat training course is available for Red Hat Fuse

91.4. インデックスの例

以下は簡単な INDEX の例です。

from("direct:index")
.to("elasticsearch5://elasticsearch?operation=INDEX&indexName=twitter&indexType=tweet");
<route>
    <from uri="direct:index" />
    <to uri="elasticsearch5://elasticsearch?operation=INDEX&indexName=twitter&indexType=tweet"/>
</route>

クライアントは、マップを含むボディーメッセージをルートに渡すだけです。結果のボディーには、作成された indexId が含まれます。

Map<String, String> map = new HashMap<String, String>();
map.put("content", "test");
String indexId = template.requestBody("direct:index", map, String.class);