Hmmm... I guess it only fail for jest? It is moved into common from the 
original native version, and the ES 1.4.4 PutMappingRequestBuilder explicitly 
supports this: 
https://github.com/elastic/elasticsearch/blob/v1.4.4/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequestBuilder.java
 (See "public PutMappingRequestBuilder setSource(Object... source)"

PutMappingRequestBuilder also seems to support a map, and Jest/GSON has a 
MapTypeAdapterFactory for converting the payload, so I guess the simplest fix 
to just use a map instead.

BR,
Dennis

-----Original Message-----
From: Kasper Sørensen [mailto:[email protected]] 
Sent: 26. april 2016 00:22
To: [email protected]
Subject: Approach to submitting ElasticSearch mapping

Hi all,

I am working on a small tool that is populating an ElasticSearch index and ran 
into an issue that I want to ask about... It seems that our ElasticSearchUtils 
class is creating the 'source' of the mapping request and that it contains an 
array of property name and then property details like 'type=string&store=true'. 
I am wondering how/why this format is used.
Everywhere else I see a nested JSON object describing the document mapping.
And when building my tool this also seemed to be the only thing I could get 
working. If I used the current MetaModel implementation then I get some funky 
error messages back from ES saying that it's not proper xcontent.

If anyone knows why it is as it is, I'd love to know :) Or is it just a plain 
bug?

Best regards,
Kasper

Reply via email to