Package org.elasticsearch.cluster.metadata

Examples of org.elasticsearch.cluster.metadata.IndexMetaData.mapping()


                    final IndexMetaData indexMetaData = currentState.metaData().index(index);
                    if (indexMetaData == null) {
                        // index got delete on us, ignore...
                        return currentState;
                    }
                    if (indexMetaData.mappings().containsKey(type) && indexMetaData.mapping(type).source().equals(mappingSource)) {
                        return currentState;
                    }

                    IndexService indexService = indicesService.indexService(index);
                    if (indexService == null) {
View Full Code Here


                        // merge from the updated into the existing, ignore conflicts (we know we have them, we just want the new ones)
                        existingMapper.merge(updatedMapper, mergeFlags().simulate(false));
                    }

                    // if we end up with the same mapping as the original once, ignore
                    if (indexMetaData.mappings().containsKey(type) && indexMetaData.mapping(type).source().equals(existingMapper.mappingSource())) {
                        return currentState;
                    }

                    // build the updated mapping source
                    if (logger.isDebugEnabled()) {
View Full Code Here

                .execute().actionGet();

        assertThat(clusterStateResponse.getState().getMetaData().getIndices().containsKey(indexWithDate), is(true));
        IndexMetaData indexMetaData = clusterStateResponse.getState().getMetaData().getIndices().get(indexWithDate);
        assertThat(indexMetaData.getMappings().containsKey("counter"), is(true));
        Map<String, Object> properties = getAsMap(indexMetaData.mapping("counter").sourceAsMap(), "properties");
        Map<String, Object> mapping = getAsMap(properties, "name");
        assertThat(mapping, hasKey("index"));
        assertThat(mapping.get("index").toString(), is("not_analyzed"));
    }
View Full Code Here

        ClusterState cs = client.admin().cluster().prepareState().setIndices(index).execute().actionGet().getState();
        IndexMetaData imd = cs.getMetaData().index(index);

        if (imd == null) return false;

        MappingMetaData mdd = imd.mapping(type);

        if (mdd != null) return true;
        return false;
    }
View Full Code Here

                createReq.mapping(mapCursor.key, mapCursor.value.sourceAsMap());
            }
            createReq.settings(settingBuilder.build());
        }
        else {
            MappingMetaData mappingMeta = indexData.mapping(type);
            createReq = new CreateIndexRequest(newIndex).
                mapping(type, mappingMeta.sourceAsMap()).
                settings(settingBuilder.build());
        }
View Full Code Here

            // If there is no index, there is no mapping either
        }

        if (imd == null) return false;

    MappingMetaData mdd = imd.mapping(type);

    if (mdd != null) return true;
    return false;
  }
View Full Code Here

            // If there is no index, there is no mapping either
        }

        if (imd == null) return false;

        MappingMetaData mdd = imd.mapping(type);

        if (mdd != null) return true;
        return false;
    }
}
View Full Code Here

        ClusterState cs = client.admin().cluster().prepareState().setIndices(index).execute().actionGet().getState();
        IndexMetaData imd = cs.getMetaData().index(index);

        if (imd == null) return false;

        MappingMetaData mdd = imd.mapping(type);

        if (mdd != null) return true;
        return false;
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.