# How to avoid syntax errors when writing DSL statements

**URL:** https://discuss.elastic.co/t/how-to-avoid-syntax-errors-when-writing-dsl-statements/258463
**Category:** Elasticsearch
**Created:** [December 12, 2020, 3:46am UTC](https://discuss.elastic.co/t/how-to-avoid-syntax-errors-when-writing-dsl-statements/258463 "2020-12-12T03:46:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![wajika](https://avatars.discourse-cdn.com/v4/letter/w/977dab/32.png) [@wajika](https://discuss.elastic.co/u/wajika)
#### Post date: [December 12, 2020, 3:46am UTC](https://discuss.elastic.co/t/how-to-avoid-syntax-errors-when-writing-dsl-statements/258463/1 "2020-12-12T03:46:23Z")

</div>

> ```
> GET index/_search
> {
> "query": {
> "range": {
> "@timestamp": {
> "gte": "now-1d/d",
> "lt": "now/d"
> }
> },
> "query_string": {
> "query": "*"
> }
> }
> }
> 
> ```

> ```
> {
> "error" : {
> "root_cause" : [
> {
> "type" : "parsing_exception",
> "reason" : "[range] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
> "line" : 9,
> "col" : 5
> }
> ],
> "type" : "parsing_exception",
> "reason" : "[range] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
> "line" : 9,
> "col" : 5
> },
> "status" : 400
> }
> 
> ```

I don't know how to write correctly when I write, and I don't know how to correct the mistakes. I don't see the document specifically indicating the scope of this keyword.

What am I missing? Please advise

---

<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: [January 9, 2021, 3:46am UTC](https://discuss.elastic.co/t/how-to-avoid-syntax-errors-when-writing-dsl-statements/258463/2 "2021-01-09T03:46:28Z")

</div>

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