[英]Delete documents from elasticsearch in Scala using RestClient
[英]Obtain the elasticsearch client using RestClient for DELETE and SCROLLAPI
我正在使用Elasticsearch保存來自Twitter的數據。 在這一點上,我很難從索引中刪除數據並使用Scroll API,因為在閱讀了有關方法后,每個人都使用了Client,而我使用了RestClient。
我正在使用什么:
RestClient restClient = RestClient.builder(
new HttpHost("localhost", 9200, "http"),
new HttpHost("localhost", 9201, "http")).build();
我發現:
對於刪除:
DeleteIndexResponse deleteResponse = client.admin().indices().delete(new DeleteIndexRequest("your-index")).actionGet()
對於滾動:
SearchResponse scrollResp = client.prepareSearch(test)
.addSort(FieldSortBuilder.DOC_FIELD_NAME, SortOrder.ASC)
.setScroll(new TimeValue(60000))
.setQuery(qb)
.setSize(100).get();
如何使用RestClient獲取客戶端? 我需要創建Java高級REST客戶端嗎? 謝謝並恭祝安康
您自己使用的elasticsearch將有一個客戶或開放社區的某個人提供,例如https://atom.io/packages/elasticsearch-client或https://www.elastic.co/guide/en/elasticsearch/ client / index.html 。 如果需要更多功能,則必須通過擴展功能來提供自己的實現。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.