Read/access field mapping information

Hi all,

In my river, I would like to access mapping information based in the
fields.
Example:
Having this mapping:
{
"tweet" : {
"properties" : {
"message" : {"type" : "string", "store" : "yes",
"enabled": false}
}
}
}

I would like to do this...

ClusterState cs =
client.admin().cluster().prepareState().setFilterIndices("my_index").execute().actionGet().getState();
IndexMetaData imd = cs.getMetaData().index("my_index");
MappingMetaData mdd = = imd.mapping("my_type");

HashMap <String, Object> mapped_node = mdd.getMapByPath("message");

... and then get the type, store and enabled as mapped_node keys, with
the corresponding value.

Is this possible?

You will need to parse it yourself from the compressed string that its
stored internally, but I will add a method to return it as Map.

On Mon, Nov 28, 2011 at 6:58 PM, vannya vannyas@gmail.com wrote:

Hi all,

In my river, I would like to access mapping information based in the
fields.
Example:
Having this mapping:
{
"tweet" : {
"properties" : {
"message" : {"type" : "string", "store" : "yes",
"enabled": false}
}
}
}

I would like to do this...

ClusterState cs =

client.admin().cluster().prepareState().setFilterIndices("my_index").execute().actionGet().getState();
IndexMetaData imd = cs.getMetaData().index("my_index");
MappingMetaData mdd = = imd.mapping("my_type");

HashMap <String, Object> mapped_node = mdd.getMapByPath("message");

... and then get the type, store and enabled as mapped_node keys, with
the corresponding value.

Is this possible?

Thanks Shay for the fast answer!
We already parse the mapping ourselves, but it will be easier with a
Map!

On Nov 28, 6:04 pm, Shay Banon kim...@gmail.com wrote:

You will need to parse it yourself from the compressed string that its
stored internally, but I will add a method to return it as Map.

On Mon, Nov 28, 2011 at 6:58 PM, vannya vann...@gmail.com wrote:

Hi all,

In my river, I would like to access mapping information based in the
fields.
Example:
Having this mapping:
{
"tweet" : {
"properties" : {
"message" : {"type" : "string", "store" : "yes",
"enabled": false}
}
}
}

I would like to do this...

ClusterState cs =

client.admin().cluster().prepareState().setFilterIndices("my_index").execut e().actionGet().getState();
IndexMetaData imd = cs.getMetaData().index("my_index");
MappingMetaData mdd = = imd.mapping("my_type");

HashMap <String, Object> mapped_node = mdd.getMapByPath("message");

... and then get the type, store and enabled as mapped_node keys, with
the corresponding value.

Is this possible?

Np, pushed it, it will be part of upcoming 0.18.5.

On Mon, Nov 28, 2011 at 8:18 PM, vannya vannyas@gmail.com wrote:

Thanks Shay for the fast answer!
We already parse the mapping ourselves, but it will be easier with a
Map!

On Nov 28, 6:04 pm, Shay Banon kim...@gmail.com wrote:

You will need to parse it yourself from the compressed string that its
stored internally, but I will add a method to return it as Map.

On Mon, Nov 28, 2011 at 6:58 PM, vannya vann...@gmail.com wrote:

Hi all,

In my river, I would like to access mapping information based in the
fields.
Example:
Having this mapping:
{
"tweet" : {
"properties" : {
"message" : {"type" : "string", "store" : "yes",
"enabled": false}
}
}
}

I would like to do this...

ClusterState cs =

client.admin().cluster().prepareState().setFilterIndices("my_index").execut
e().actionGet().getState();

IndexMetaData imd = cs.getMetaData().index("my_index");
MappingMetaData mdd = = imd.mapping("my_type");

HashMap <String, Object> mapped_node = mdd.getMapByPath("message");

... and then get the type, store and enabled as mapped_node keys, with
the corresponding value.

Is this possible?