MappingMetaData json


(Ridvan Gyundogan) #1

Hello,

I have a json file containing the elasticsearch mapping for a type -
let's call it "mapping.json".

Currently we use Map<String, Object> mapping =
mapper.readValue(mappingFileContent, HashMap.class) and then
mapping.get("properties") to get the list of properties etc. We prefer
if there was something like ElasticMapping.class so that we can say
ElasticMapping elasticMapping = mapper.readValue(mappingFileContent,
ElasticMapping.class) .

And then elasticMapping.getProperties().get(0).getType() ....

I see there is MappingMetadata.class but it doesn't look that it is
created with this purpose?


(Shay Banon) #2

There isn't a static view of the mapping at the level (classes that map one
to one, fields wise, to how the mappings are defined), its not needed in
elasticsearch.

On Mon, Sep 26, 2011 at 4:44 PM, Ridvan Gyundogan ridvansg@gmail.comwrote:

Hello,

I have a json file containing the elasticsearch mapping for a type -
let's call it "mapping.json".

Currently we use Map<String, Object> mapping =
mapper.readValue(mappingFileContent, HashMap.class) and then
mapping.get("properties") to get the list of properties etc. We prefer
if there was something like ElasticMapping.class so that we can say
ElasticMapping elasticMapping = mapper.readValue(mappingFileContent,
ElasticMapping.class) .

And then elasticMapping.getProperties().get(0).getType() ....

I see there is MappingMetadata.class but it doesn't look that it is
created with this purpose?


(Ridvan Gyundogan) #3

We will probably create one for our custom needs. Ok, thanks for the
fast answer.

On Sep 26, 7:02 pm, Shay Banon kim...@gmail.com wrote:

There isn't a static view of the mapping at the level (classes that map one
to one, fields wise, to how the mappings are defined), its not needed in
elasticsearch.

On Mon, Sep 26, 2011 at 4:44 PM, Ridvan Gyundogan ridva...@gmail.comwrote:

Hello,

I have a json file containing the elasticsearch mapping for a type -
let's call it "mapping.json".

Currently we use Map<String, Object> mapping =
mapper.readValue(mappingFileContent, HashMap.class) and then
mapping.get("properties") to get the list of properties etc. We prefer
if there was something like ElasticMapping.class so that we can say
ElasticMapping elasticMapping = mapper.readValue(mappingFileContent,
ElasticMapping.class) .

And then elasticMapping.getProperties().get(0).getType() ....

I see there is MappingMetadata.class but it doesn't look that it is
created with this purpose?


(system) #4