ef-labs / vertx-elasticsearch-service

Vert.x elasticsearch service with event bus proxying
57 stars 18 forks source link

Fix indexing of deep objects #17

Closed marcust closed 9 years ago

marcust commented 9 years ago

JsonObject.getMap returns the original map from inside JsonObject. Deep nested objects are contained there as JsonObject Objects which implements Iterable of Map.Entry. IndexRequestBuilder.setSource(Map) uses XContentBuilder to transform the objects it gets. For an Iterable it creates an array of the items, in thatcase their toString value. This basically destroys indexing of nested object with the module, becuase the become an array of "key=value" Strings.

This patch changes the "getMap" to "encode" in order to hand the actual json to Elasticsearch.

adrianluisgonzalez commented 9 years ago

@marcust , I think this has already been fixed in 2.1.0-SNAPSHOT: https://github.com/englishtown/vertx-elasticsearch-service/blob/develop/src/main/java/com/englishtown/vertx/elasticsearch/impl/DefaultElasticSearchService.java#L79

marcust commented 9 years ago

Yes, that seems to be the same thing.