Mohan Kumar
Mohan Kumar

Reputation: 631

How to get fieldmapping of all indices in java

I know to the below command is enough throught REST

get _all/_mapping

but how to do in java using elastic search api?

Upvotes: 1

Views: 225

Answers (1)

Val
Val

Reputation: 217274

You can do this simply with the indices admin client like this:

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

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

    ...

Upvotes: 1

Related Questions