How Do You Get The List of Fields For An Index?

How do you query and index for the list of fields in the index?

Thanks.


Ed Brown

Using the Java API?

On Monday, April 9, 2012 3:13:56 PM UTC-4, Ed Brown VSTI wrote:

How do you query and index for the list of fields in the index?

Thanks.


Ed Brown

// Get cluster state
ClusterState clusterState =
client1.admin().cluster().prepareState().execute().actionGet().state();

// Get mapping from the cluster state
MappingMetaData mappingMetaData =
clusterState.metaData().index("my_index").mappings().get("my_type");

// Get the list of fields from the mapping
Map<String, Object> fields = (Map<String, Object>)
mappingMetaData.sourceAsMap().get("properties");

On Monday, April 9, 2012 3:23:24 PM UTC-4, Ed Brown VSTI wrote:

Using the Java API?

On Monday, April 9, 2012 3:13:56 PM UTC-4, Ed Brown VSTI wrote:

How do you query and index for the list of fields in the index?

Thanks.


Ed Brown

Thanks!

On Tuesday, April 10, 2012 6:46:51 PM UTC-4, Igor Motov wrote:

// Get cluster state
ClusterState clusterState =
client1.admin().cluster().prepareState().execute().actionGet().state();

// Get mapping from the cluster state
MappingMetaData mappingMetaData =
clusterState.metaData().index("my_index").mappings().get("my_type");

// Get the list of fields from the mapping
Map<String, Object> fields = (Map<String, Object>)
mappingMetaData.sourceAsMap().get("properties");

On Monday, April 9, 2012 3:23:24 PM UTC-4, Ed Brown VSTI wrote:

Using the Java API?

On Monday, April 9, 2012 3:13:56 PM UTC-4, Ed Brown VSTI wrote:

How do you query and index for the list of fields in the index?

Thanks.


Ed Brown

This was really helpful. Thanks. :slight_smile:

On Wednesday, 11 April 2012 04:16:51 UTC+5:30, Igor Motov wrote:

// Get cluster state
ClusterState clusterState =
client1.admin().cluster().prepareState().execute().actionGet().state();

// Get mapping from the cluster state
MappingMetaData mappingMetaData =
clusterState.metaData().index("my_index").mappings().get("my_type");

// Get the list of fields from the mapping
Map<String, Object> fields = (Map<String, Object>)
mappingMetaData.sourceAsMap().get("properties");

On Monday, April 9, 2012 3:23:24 PM UTC-4, Ed Brown VSTI wrote:

Using the Java API?

On Monday, April 9, 2012 3:13:56 PM UTC-4, Ed Brown VSTI wrote:

How do you query and index for the list of fields in the index?

Thanks.


Ed Brown

--