RestElasticClient implements ElasticClient { @Override public Map<String, Object> getMapping(String indexName, String type) throws IOException { final Map<String, Mapping> mappings = getMappings(indexName, type); final Map<String,Object> properties; if (getVersion() < 7 && mappings.containsKey(type)) { properties = mappings.get(type).getProperties(); } else if (getVersion() >= 7) { final Mapping mapping = mappings.values().stream().findFirst().orElse(null); properties = mapping != null ? mapping.getProperties() : null; } else { properties = null; } return properties; } RestElasticClient(RestClient client);  RestElasticClient(RestClient client, RestClient proxyClient, boolean enableRunAs); @Override double getVersion(); @Override List<String> getTypes(String indexName); @Override Map<String, Object> getMapping(String indexName, String type); @Override ElasticResponse search(String searchIndices, String type, ElasticRequest request); @Override ElasticResponse scroll(String scrollId, Integer scrollTime); @Override void clearScroll(Set<String> scrollIds); @Override void close(); @SuppressWarnings("unchecked") static void removeMapping(String parent, String key, Map<String,Object> data, String currentParent);  }
@Test public void testGetMapping() throws IOException { String content = "{\"status_s\": {\"mappings\":" + "{\"properties\": {\"status_s\": {\"type\": \"keyword\"}}}}}"; InputStream inputStream = new ByteArrayInputStream(content.getBytes()); when(mockEntity.getContent()).thenReturn(inputStream); when(mockRestClient.performRequest(new Request("GET", "/status_s/_mapping"))).thenReturn(mockResponse); Map<String, Map<String, String>> expected = ImmutableMap.of("status_s", ImmutableMap.of("type","keyword")); assertEquals(expected, client.getMapping("status_s", "active")); }