Using java api to get index types

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:

  1. Present list of indices defined in my ES cluster (done)
  2. Based on selection from #1, present list of "type(s)" associated to that
    index (???)
  3. Present mappings for that index/type combination (done, once I solve #2)

Thanks!

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

// 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:

  1. Present list of indices defined in my ES cluster (done)
  2. Based on selection from #1, present list of "type(s)" associated to
    that index (???)
  3. Present mappings for that index/type combination (done, once I solve #2)

Thanks!

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

perfect, thanks Imdad!

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:

  1. Present list of indices defined in my ES cluster (done)
  2. Based on selection from #1, present list of "type(s)" associated to
    that index (???)
  3. Present mappings for that index/type combination (done, once I solve
    #2)

Thanks!

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.