# Using Lucene Query Syntax

**URL:** <https://discuss.elastic.co/t/using-lucene-query-syntax/150380>\
**Category:** Elasticsearch\
**Created:** [September 28, 2018, 7:01pm UTC](https://discuss.elastic.co/t/using-lucene-query-syntax/150380 "2018-09-28T19:01:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TomTom](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomtom/32/3676_2.png) [@TomTom](https://discuss.elastic.co/u/TomTom)\
**Post date:** [September 28, 2018, 7:01pm UTC](https://discuss.elastic.co/t/using-lucene-query-syntax/150380/1 "2018-09-28T19:01:10Z")

</div>

Currently i storage dates in `strict_date_time_no_millis` ( `yyyy-MM-dd'T'HH:mm:ssZZ` eg.: 2018-09-27T14:13:41-0300).

When i try use Lucene Query to find data a error occurs:

```
{
	"from": 0,
	"size": 30,
	"query": {
		"query_string": {
			"query": "creation:'2018-09-27T14:13:41-0300'"
		}
	}
}

```

Error:

```
{
	"error": {
		"root_cause": [
			{
				"type": "query_shard_exception",
				"reason": "Failed to parse query [creation:'2018-09-27T14:13:41-0300']",
				"index_uuid": "KvCPLylCS6KCszKqgEtVBg",
				"index": "tickets"
			}
		],
...
}

```

What is wrong? I tried search using only the date and date/hour, and the same errors occurs (eg.: '2018-09-27', '2018-09-27 14:13:14')

By the way, is possible search just for the day and exclude the hour? Like: 'creation:\>='2018-09-27''

Another question, i can use script\_fields and scripts created with Painless to search data with Lucene?

---

<div class="post-metadata">

**Author:** ![TomTom](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomtom/32/3676_2.png) [@TomTom](https://discuss.elastic.co/u/TomTom)\
**Post date:** [October 1, 2018, 1:06pm UTC](https://discuss.elastic.co/t/using-lucene-query-syntax/150380/2 "2018-10-01T13:06:54Z")

</div>

Solved, just replace : to \\:

```auto
{
	"from": 0,
	"size": 30,
	"query": {
		"query_string": {
			"query": "creation:2018-09-27T14\\:13\\:41-0300"
		}
	}
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 29, 2018, 1:06pm UTC](https://discuss.elastic.co/t/using-lucene-query-syntax/150380/3 "2018-10-29T13:06:57Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
