-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unparseable date. java.utils.Date could not be parsed back. #34
Comments
Which version of the module are you using? |
I tried both versions: head and 0.3. |
Ok, just to log the result of my short search for the problem:
Felipe: any idea if the date format was changed in elasticsearch? I assume you chose this date format for a reason? |
With 0.3 I cannot index a date field without an exception, so let me fix that first. I'm pretty sure it will also fix your issue.
|
Ok, I have fixed this by using the date formatter used by elastic search. |
* org_elastic/master: (28 commits) 0.4 release Add MapperTransformer Use AbstractFieldMapper#getFieldValue() Some refactoring; Mapper prefix folded into AbstractFieldMapper feliperazeek#32 Added a transformer which uses a mapper Make sure the user has not requested unknown fields Minor restructuring Made AFM#addField() non-static so we can access meta directly Log json for index operation Fix for feliperazeek#36 (Class references not cleaned up on hot reload) Fix for feliperazeek#38 (@onetomany causes "Type not allowed" exception) Fix for feliperazeek#34 (cannot parse indexed date on record retrieval) Upgrade to ES 0.18.5 Fix for feliperazeek#37 (do not index @transient fields) Fixed elasticSearch tag path (fixes bug in _at least_ 1.2.4-RC3) Fixed route indentation to make file more readable Add support for Float conversion to ReflectionUtil Releasing 0.3 setQuery(QueryBuilder) is available from es-0.17.0 (See ES issue 994) Log type mapping ... Conflicts: conf/routes
For some reason date filed could not be parsed back from elastic DB to an entity which has this date field.
I have very straightforward entity like:
@entity
@ElasticSearchable
class Article extends Model {
....
public String title;
....
public Date issueDate;
}
Indexing of this class performs well. But when you make query you've got following exception:
java.text.ParseException: Unparseable date: "2007-01-01T00:00:00.000Z"
at java.text.DateFormat.parse(DateFormat.java:337)
at play.modules.elasticsearch.util.ReflectionUtil.getDate(ReflectionUtil.java:520)
at play.modules.elasticsearch.util.ReflectionUtil.convertToDate(ReflectionUtil.java:502)
at play.modules.elasticsearch.util.ReflectionUtil.setFieldValue(ReflectionUtil.java:367)
at play.modules.elasticsearch.util.ReflectionUtil.setFieldValue(ReflectionUtil.java:339)
at play.modules.elasticsearch.transformer.Transformer.toSearchResults(Transformer.java:68)
at play.modules.elasticsearch.Query.fetch(Query.java:173)
at play.modules.elasticsearch.ElasticSearch.search(ElasticSearch.java:145)
at play.modules.elasticsearch.ElasticSearch.search(ElasticSearch.java:96)
at utils.SimpleQueryBuilderTest.testShouldAndMust(SimpleQueryBuilderTest.java:64)
The entity is stored in elastic DB like that:
{
}
The text was updated successfully, but these errors were encountered: