toastdriven/django-haystack — Issue #507: ElasticSearch incorrectly builds queries for filtering on datetime indexes.
Author: melinath
Created: 2012-02-13 21:03:29+00:00
State: open

This is an issue on the current master branch. Running a query like ```SearchQuerySet().filter(best_date_with_published=datetime(2011, 6, 9, 6, 42, 43)``` results in the following error:

```
ParseException[Cannot parse \'best_date_with_published:2011-06-09T06:42:43\': Encountered " ":" ": "" at line 1, column
38.\nWas expecting one of:\n \n ...\n ...\n ...\n "+" ...\n "-" ...\n "(" ...\n "*" ...\n "^"
...\n ...\n ...\n ...\n ...\n ...\n "[" ...\n "{" ...\n
...\n ]; nested: ParseException[Encountered " ":" ": "" at line 1, column 38.\nWas expecting one of:\n \n
...\n ...\n ...\n "+" ...\n "-" ...\n "(" ...\n "*" ...\n "^" ...\n ...\n ...\n
...\n ...\n ...\n "[" ...\n "{" ...\n ...\n ]; }]
```

AFAICT the issue seems to be that the datetime should be passed in as a quoted string rather than as a raw string. I'm working on finding where in the code to correct this and expect to be opening a pull request later today.