简体   繁体   English

如何在Java中获取所有索引的字段映射

[英]How to get fieldmapping of all indices in java

I know to the below command is enough throught REST 我知道以下命令通过REST就足够了

get _all/_mapping

but how to do in java using elastic search api? 但是如何在Java中使用弹性搜索API?

You can do this simply with the indices admin client like this: 您可以使用indexs管理员客户端简单地执行此操作,如下所示:

    GetMappingsResponse response = client()
        .admin()
        .indices()
        .prepareGetMappings()
        .execute()
        .actionGet();

    ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> mappings = response.getMappings();

    ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM