public boolean existsMapping ( String indexName , String mappingName ) { ClusterStateResponse resp = this . client . admin ( ) . cluster ( ) . prepareState ( ) . execute ( ) . actionGet ( ) ; if ( resp . getState ( ) . getMetaData ( ) . index ( indexName ) == null ) { return false ; } ImmutableOpenMap < String , MappingMetaData > mappings = resp . getState ( ) . getMetaData ( ) . index ( indexName ) . getMappings ( ) ; if ( mappings . get ( mappingName ) != null ) { return true ; } return false ; }
Check if a mapping exists in an expecific index .