I have been beating my head against the wall trying to find a way to get
just the "types" that are associated to a given index. Ultimately, I am
trying to retrieve the mappings for a given index/type combination. I know
how to get the mappings from the IndexMetaData object, but it requires that
I know the types. What I am doing is building an UI to allow users to view
the mappings for a chosen index and type. However, I cannot find a way to
just fetch the types for a given index using the java API. From a UI
perspective, I am trying to do the following:
Present list of indices defined in my ES cluster (done)
Based on selection from #1, present list of "type(s)" associated to that
index (???)
Present mappings for that index/type combination (done, once I solve #2)
// client is an object of org.elasticsearch.client.Client
ClusterStateResponse clusterStateResponse =
client.admin().cluster().prepareState().execute().actionGet();
ImmutableMap<String,MappingMetaData> indexMappings =
clusterStateResponse.state().getMetaData().index(indexName).getMappings();
// The keys in indexMappings correspond to type names
On Monday, July 8, 2013 8:35:05 PM UTC+5:30, my3sons wrote:
I have been beating my head against the wall trying to find a way to get
just the "types" that are associated to a given index. Ultimately, I am
trying to retrieve the mappings for a given index/type combination. I know
how to get the mappings from the IndexMetaData object, but it requires that
I know the types. What I am doing is building an UI to allow users to view
the mappings for a chosen index and type. However, I cannot find a way to
just fetch the types for a given index using the java API. From a UI
perspective, I am trying to do the following:
Present list of indices defined in my ES cluster (done)
Based on selection from #1, present list of "type(s)" associated to
that index (???)
Present mappings for that index/type combination (done, once I solve #2)
On Mon, Jul 8, 2013 at 10:18 AM, Imdad Ahmed imdhmd@gmail.com wrote:
// client is an object of org.elasticsearch.client.Client
ClusterStateResponse clusterStateResponse =
client.admin().cluster().prepareState().execute().actionGet();
ImmutableMap<String,MappingMetaData> indexMappings =
clusterStateResponse.state().getMetaData().index(indexName).getMappings();
// The keys in indexMappings correspond to type names
On Monday, July 8, 2013 8:35:05 PM UTC+5:30, my3sons wrote:
I have been beating my head against the wall trying to find a way to get
just the "types" that are associated to a given index. Ultimately, I am
trying to retrieve the mappings for a given index/type combination. I know
how to get the mappings from the IndexMetaData object, but it requires that
I know the types. What I am doing is building an UI to allow users to view
the mappings for a chosen index and type. However, I cannot find a way to
just fetch the types for a given index using the java API. From a UI
perspective, I am trying to do the following:
Present list of indices defined in my ES cluster (done)
Based on selection from #1, present list of "type(s)" associated to
that index (???)
Present mappings for that index/type combination (done, once I solve #2)
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.