Get mapping through org.elasticsearch.client.Client


(Ridvan Gyundogan) #1

Hi guys,
if someone can give a hint how to get the mapping information through
org.elasticsearch.client.Client.


The gist above always returns false.


(Ridvan Gyundogan) #2

Ok I found this article
http://groups.google.com/group/elasticsearch/browse_thread/thread/278b52de3be37c08/445dacab328a6a6d?lnk=gst&q=mapping+Client#445dacab328a6a6d
which replies to my question.

On Nov 30, 3:10 pm, Ridvan Gyundogan ridva...@gmail.com wrote:

Hi guys,
if someone can give a hint how to get the mapping information through
org.elasticsearch.client.Client.https://gist.github.com/1409001
The gist above always returns false.


(Ridvan Gyundogan) #3

And here is a method if someone needs it:
public MappingMetaData getIndexMetaData(Client esClient, String
indexName,
String documentType) {
ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
clusterStateRequest.filteredIndices(indexName);
ClusterStateResponse clusterStateResponse =
esClient.admin().cluster().state(clusterStateRequest).actionGet();
MetaData metaData = clusterStateResponse.state().metaData();
MappingMetaData mappingMetaData = null;
for(IndexMetaData indexMetaData : metaData){
mappingMetaData =
indexMetaData.getMappings().get(documentType);
if(mappingMetaData!=null){
break;
}
}
return mappingMetaData;
}

On Nov 30, 3:43 pm, Ridvan Gyundogan ridva...@gmail.com wrote:

Ok I found this articlehttp://groups.google.com/group/elasticsearch/browse_thread/thread/278...
which replies to my question.

On Nov 30, 3:10 pm, Ridvan Gyundogan ridva...@gmail.com wrote:

Hi guys,
if someone can give a hint how to get the mapping information through
org.elasticsearch.client.Client.https://gist.github.com/1409001
The gist above always returns false.


(system) #4