@Test public void getIndexMappingsWithEmptyMapping() { String indexName = "test"; ElasticsearchNodeClient client = mockClient(indexName, ""); Map<String, IndexMapping> indexMappings = client.getIndexMappings(indexName); assertEquals(1, indexMappings.size()); IndexMapping indexMapping = indexMappings.values().iterator().next(); assertEquals(0, indexMapping.size()); }
@Override public Map<String, IndexMapping> getIndexMappings(String indexExpression) { try { ClusterState state = clusterService.state(); String[] concreteIndices = resolveIndexExpression(state, new String[] {indexExpression}); return populateIndexMappings( state.metadata().findMappings(concreteIndices, ALL_TYPES, ALL_FIELDS)); } catch (IOException e) { throw new IllegalStateException( "Failed to read mapping in cluster state for index pattern [" + indexExpression + "]", e); } }
ElasticsearchNodeClient implements ElasticsearchClient { @Override public Map<String, IndexMapping> getIndexMappings(String indexExpression) { try { ClusterState state = clusterService.state(); String[] concreteIndices = resolveIndexExpression(state, new String[] {indexExpression}); return populateIndexMappings( state.metadata().findMappings(concreteIndices, ALL_TYPES, ALL_FIELDS)); } catch (IOException e) { throw new IllegalStateException( "Failed to read mapping in cluster state for index pattern [" + indexExpression + "]", e); } } }
ElasticsearchNodeClient implements ElasticsearchClient { @Override public Map<String, IndexMapping> getIndexMappings(String indexExpression) { try { ClusterState state = clusterService.state(); String[] concreteIndices = resolveIndexExpression(state, new String[] {indexExpression}); return populateIndexMappings( state.metadata().findMappings(concreteIndices, ALL_TYPES, ALL_FIELDS)); } catch (IOException e) { throw new IllegalStateException( "Failed to read mapping in cluster state for index pattern [" + indexExpression + "]", e); } }  }
ElasticsearchNodeClient implements ElasticsearchClient { @Override public Map<String, IndexMapping> getIndexMappings(String indexExpression) { try { ClusterState state = clusterService.state(); String[] concreteIndices = resolveIndexExpression(state, new String[] {indexExpression}); return populateIndexMappings( state.metadata().findMappings(concreteIndices, ALL_TYPES, ALL_FIELDS)); } catch (IOException e) { throw new IllegalStateException( "Failed to read mapping in cluster state for index pattern [" + indexExpression + "]", e); } }  @Override Map<String, IndexMapping> getIndexMappings(String indexExpression); @Override ElasticsearchResponse search(ElasticsearchRequest request); @Override void cleanup(ElasticsearchRequest request); @Override void schedule(Runnable task); }
ElasticsearchNodeClient implements ElasticsearchClient { @Override public Map<String, IndexMapping> getIndexMappings(String indexExpression) { try { ClusterState state = clusterService.state(); String[] concreteIndices = resolveIndexExpression(state, new String[] {indexExpression}); return populateIndexMappings( state.metadata().findMappings(concreteIndices, ALL_TYPES, ALL_FIELDS)); } catch (IOException e) { throw new IllegalStateException( "Failed to read mapping in cluster state for index pattern [" + indexExpression + "]", e); } }  @Override Map<String, IndexMapping> getIndexMappings(String indexExpression); @Override ElasticsearchResponse search(ElasticsearchRequest request); @Override void cleanup(ElasticsearchRequest request); @Override void schedule(Runnable task); static final String[] ALL_TYPES; static final Function<String, Predicate<String>> ALL_FIELDS; }