欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

分布式搜索Elasticsearch 创建客户端(三)

程序员文章站 2022-05-13 14:08:57
...

原文链接:http://blog.csdn.net/geloin/article/details/8476614

 

 

4. org.elasticsearch.client.IndicesAdminClient接口

IndicesAdminClient提供了针对索引的action的operation的管理进行操作的接口,它有以下方法:

1) exists(IndicesExistsRequest request)、exists(IndicesExistsRequest request, ActionListener<IndicesExistsResponse> listener)、prepareExists(String... indices),索引是否存在;

2) typesExists(TypesExistsRequest request)、typesExists(TypesExistsRequest request, ActionListener<TypesExistsResponse> listener)、prepareTypesExists(String... index),type是否存在;

 

3) stats(IndicesStatsRequest request)、stats(IndicesStatsRequest request, ActionListener<IndicesStats> listener)、prepareStats(String... indices),索引统计;

4) status(IndicesStatusRequest request)、status(IndicesStatusRequest request, ActionListener<IndicesStatusResponse> listener)、prepareStatus(String... indices),索引状态;

 

5) segments(IndicesSegmentsRequest request)、segments(IndicesSegmentsRequest request, ActionListener<IndicesSegmentResponse> listener)、prepareSegments(String... indices),索引的段;

6) create(CreateIndexRequest request)、create(CreateIndexRequest request, ActionListener<CreateIndexResponse> listener)、prepareCreate(String index),基于显示的设置创建索引;

 

7) delete(DeleteIndexRequest request)、delete(DeleteIndexRequest request, ActionListener<DeleteIndexResponse> listener)、prepareDelete(String... indices),基于索引名称删除索引;

8) close(CloseIndexRequest request)、close(CloseIndexRequest request, ActionListener<CloseIndexResponse> listener)、prepareClose(String index),基于索引名称关闭索引;

 

9) open(OpenIndexRequest request)、open(OpenIndexRequest request, ActionListener<OpenIndexResponse> listener)、prepareOpen(String index),基于索引名称打开索引;

10) refresh(RefreshRequest request)、refresh(RefreshRequest request, ActionListener<RefreshResponse> listener)、prepareRefresh(String... indices),刷新索引;

 

11) flush(FlushRequest request)、flush(FlushRequest request, ActionListener<FlushResponse> listener)、prepareFlush(String... indices),刷新索引(从节点中释放内存);

12) optimize(OptimizeRequest request)、optimize(OptimizeRequest request, ActionListener<OptimizeResponse> listener)、prepareOptimize(String... indices),优化索引到片段中;

 

13) putMapping(PutMappingRequest request)、putMapping(PutMappingRequest request, ActionListener<PutMappingResponse> listener)、preparePutMapping(String... indices),定义映射关系,在这里可定义解析器,如paoding;

14) deleteMapping(DeleteMappingRequest request)、deleteMapping(DeleteMappingRequest request, ActionListener<DeleteMappingResponse> listener)、prepareDeleteMapping(String... indices),删除索引的映射;

15) gatewaySnapshot(GatewaySnapshotRequest request)、gatewaySnapshot(GatewaySnapshotRequest request, ActionListener<GatewaySnapshotResponse> listener)、prepareGatewaySnapshot(String... indices),为索引执行网关快照;

 

16) aliases(IndicesAliasesRequest request)、aliases(IndicesAliasesRequest request, ActionListener<IndicesAliasesResponse> listener)、prepareAliases(),允许为索引添加或删除别名;

17) clearCache(ClearIndicesCacheRequest request)、clearCache(ClearIndicesCacheRequest request, ActionListener<ClearIndicesCacheResponse> listener)、prepareClearCache(String... indices),清空索引缓存;

 

18) updateSettings(UpdateSettingsRequest request)、updateSettings(UpdateSettingsRequest request, ActionListener<UpdateSettingsResponse> listener)、prepareUpdateSettings(String... indices),为索引更新设置;

19) analyze(AnalyzeRequest request)、analyze(AnalyzeRequest request, ActionListener<AnalyzeResponse> listener)、prepareAnalyze(@Nullable String index, String text),提取索引后分析文本;

 

20) putTemplate(PutIndexTemplateRequest request)、putTemplate(PutIndexTemplateRequest request, ActionListener<PutIndexTemplateResponse> listener)、preparePutTemplate(String name),设置索引模板;

21) deleteTemplate(DeleteIndexTemplateRequest request)、deleteTemplate(DeleteIndexTemplateRequest request, ActionListener<DeleteIndexTemplateResponse> listener)、prepareDeleteTemplate(String name),删除索引模板;

 

22) validateQuery(ValidateQueryRequest request)、validateQuery(ValidateQueryRequest request, ActionListener<ValidateQueryResponse> listener)、prepareValidateQuery(String... indices),验证查询的正确性;

23) putWarmer(PutWarmerRequest request)、putWarmer(PutWarmerRequest request, ActionListener<PutWarmerResponse> listener)、preparePutWarmer(String name),适当的时候,将候补搜索变更为可执行状态;

 

24) deleteWarmer(DeleteWarmerRequest request)、deleteWarmer(DeleteWarmerRequest request, ActionListener<DeleteWarmerResponse> listener)、prepareDeleteWarmer(),删除候补索引。

 

25) GetIndexTemplatesRequestBuilder prepareGetTemplates(String... name); //获取索引模板,当name为*号时则获取所有