The issue has nothing to do with JSON. Indexing any Java collection is
easy with a change of the method:
Replace List with Collection and you should now be able to index items
such as Sets and even Vectors. Currently, a Set uses the Object level
Since the if-elsif statements does not find set, it simply gets
converted with toString, but the List method would work perfectly.
The issue is very minor. The workaround is simple, but it would be
nice to have Collection level support and not just List.
On Wed, Nov 30, 2011 at 3:09 AM, Shay Banon email@example.com wrote:
The aim is not to create a full object to json mapping in elasticsearch, use
jackson for that.
On Wed, Nov 30, 2011 at 2:10 AM, Ivan Brusic firstname.lastname@example.org wrote:
Started using ElasticSearch on a new (to me) project and came across a
small issue while indexing sets.
Set set = ...
The code will call the overloaded method XContentBuilder#field(String
name, Object value), since there is no method for the more restrictive
type Set. There is an overloaded method for
XContentBuilder#field(String name, List value), so the solution is to
simply create a list out of the set. However, looking at the latter
method, there should be no reason why the type should not be
Collection and not just List.