21.7. 인덱스 예
다음은 간단한 INDEX 예제입니다.
from("direct:index") .to("elasticsearch://elasticsearch?operation=Index&indexName=twitter");
from("direct:index")
.to("elasticsearch://elasticsearch?operation=Index&indexName=twitter");
<route> <from uri="direct:index"/> <to uri="elasticsearch://elasticsearch?operation=Index&indexName=twitter"/> </route>
<route>
<from uri="direct:index"/>
<to uri="elasticsearch://elasticsearch?operation=Index&indexName=twitter"/>
</route>
이 작업의 경우 indexId 헤더를 지정해야 합니다.
클라이언트는 간단히 맵이 포함된 본문 메시지를 경로에 전달해야 합니다. 결과 본문에는 생성된 indexId가 포함됩니다.
Map<String, String> map = new HashMap<String, String>(); map.put("content", "test"); String indexId = template.requestBody("direct:index", map, String.class);
Map<String, String> map = new HashMap<String, String>();
map.put("content", "test");
String indexId = template.requestBody("direct:index", map, String.class);