I am using Java client. I wanted to convert elasticsearch objects to JSON responses. The JSON result above was the expected result.
I successfully convert it with Jackson by switching SerializationFeature.FAIL_ON_EMPTY_BEANS to false which seems mandatory to serialize aggregation elasticsearch objects. Sorry, my question wasn't clear. On Wednesday, September 17, 2014 3:53:58 PM UTC+2, David Pilato wrote: > > Why don't you use Java client? > > If you are using it why do you need to convert JSON responses to > elasticsearch objects? > I don't understand exactly what you are trying to do here. > > > -- > *David Pilato* | *Technical Advocate* | *Elasticsearch.com* > @dadoonet <https://twitter.com/dadoonet> | @elasticsearchfr > <https://twitter.com/elasticsearchfr> > > > Le 17 septembre 2014 à 11:57:24, [email protected] <javascript:> ( > [email protected] <javascript:>) a écrit: > > I have a problem with Java API and aggregations result > > Serializer (jackson) produce this error: > > No serializer found for class org.elasticsearch.common.text.StringText > and no properties discovered to create BeanSerializer > > > for this query : > > > 1. { > 2. "size": 0, > 3. "aggregations": { > 4. "agg": { > 5. "global": {}, > 6. "aggregations": { > 7. "dim-1": { > 8. "terms": { > 9. "field": "field-1" > 10. }, > 11. "aggregations": { > 12. "dim-2": { > 13. "terms": { > 14. "field": "field-2" > 15. }, > 16. "aggregations": { > 17. "myStats": { > 18. "stats": { > 19. "field": "statsField" > 20. } > 21. } > 22. } > 23. } > 24. } > 25. } > 26. } > 27. } > 28. } > 29. } > > > > with this response : > > > 1. { > 2. "took":15932, > 3. "timed_out":false, > 4. "_shards":{ > 5. "total":2, > 6. "successful":2, > 7. "failed":0 > 8. }, > 9. "hits":{ > 10. "total":38376901, > 11. "max_score":0, > 12. "hits":[ > 13. > 14. ] > 15. }, > 16. "aggregations":{ > 17. "agg":{ > 18. "doc_count":38376901, > 19. "dim-1":{ > 20. "buckets":[ > 21. { > 22. "key":27380, > 23. "doc_count":311352, > 24. "dim-2":{ > 25. "buckets":[ > 26. { > 27. "key":1, > 28. "doc_count":275581, > 29. "statsField":{ > 30. "count":275581, > 31. "min":245, > 32. "max":1295001, > 33. "avg":111170.57729999075, > 34. "sum":30636498862.908752 > 35. } > 36. }, > 37. { > 38. "key":2, > 39. "doc_count":35771, > 40. "statsField":{ > 41. "count":35771, > 42. "min":300, > 43. "max":2070000, > 44. <div class="de2" style="-webkit-user-select: text; padding-right: > 5px; padding-left: 5px; vertical-align: top; color: rgb(0, 0, 0); > border-left-width: 1px; border-left-style: solid; border-left-color: > rgb(204, 204, 204); margin-left: -7px; position: relative; line-height: > 21px; backgrou > > ... -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/445d7b7f-fe03-4df3-87f4-fbe54b058c62%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
