# Query\_Template Format in Elastic Search filter plugin

**URL:** <https://discuss.elastic.co/t/query-template-format-in-elastic-search-filter-plugin/138482>\
**Category:** Logstash\
**Created:** [July 4, 2018, 6:02am UTC](https://discuss.elastic.co/t/query-template-format-in-elastic-search-filter-plugin/138482 "2018-07-04T06:02:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul1243](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@paul1243](https://discuss.elastic.co/u/paul1243)\
**Post date:** [July 4, 2018, 6:02am UTC](https://discuss.elastic.co/t/query-template-format-in-elastic-search-filter-plugin/138482/1 "2018-07-04T06:02:31Z")

</div>

Hi -  
I just trying to run a GET request with the dsl script using the query\_template config in ES filter plugin on logstash. I believe something is wrong with the JSON request . Could someone please help me out.

**template.json:**

```auto
 GET test_data-*/_search
 {
    "aggs": {
            "2": {
                "terms": {
                    "field": "job_name.keyword",
                    "include": "Sanity_Job",
                    "size": 1,
                    "order": {
                        "_term": "desc"
                    }
                },
                "aggs": {
                    "passed": {
                        "sum": {
                            "field": "Passed"
                        }
                    },
                    "failed": {
                        "sum": {
                            "field": "Failed"
                        }
                    },
                    "skipped": {
                        "sum": {
                            "field": "Skipped"
                        }
                    }
                }
            }
        },
        "query": {
            "bool": {
                "must": [
                    "range": {
                        "@timestamp": {
                            "gte": "now-7d/d",
                            "lte": "now"
                        }
                    }
                ]
            }
        }
    }

```

**logstash config:**

```auto
filter {
 elasticsearch {
   hosts => "http://localhost:9200"
   index => "test_results-*"
   query_template => "template.json"
 }
}

```

---

<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:** [August 1, 2018, 6:02am UTC](https://discuss.elastic.co/t/query-template-format-in-elastic-search-filter-plugin/138482/2 "2018-08-01T06:02:37Z")

</div>

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