Custom GSON
futurechan opened this issue · 1 comments
futurechan commented
All of my timestamps are longs. The searches work except when I use a JestResultsExtractor
. Here's an example query:
SearchQuery query = new NativeSearchQueryBuilder()
.withIndices("my_index")
.withTypes("my_type")
.withFilter(boolQuery()
.filter(termQuery("someField", fieldId))
)
.build();
return ((JestElasticsearchTemplate) elasticsearchTemplate).query(query,
(JestResultsExtractor<List<SearchResult.Hit<MyType, Void>>>) response -> response.getHits(MyType.class));
When I execute the query above I get the following error:
com.google.gson.JsonSyntaxException: 1568127600000
at com.google.gson.DefaultDateTypeAdapter.deserializeToDate(DefaultDateTypeAdapter.java:151) ~[gson-2.8.5.jar!/:?]
How can I tell jest to use a different GSON date format?
I'm using Spring Data Jest 3.1.5.RELEASE against Elasticsearch 5.5.3.
VanRoy commented
Hi @futurechan Can you send me a sample of "MyType" and the full stack trace ?
Thanks.