# Converting an ElasticSearch 1.7 compatible template into an ElasticSearch 2.3 template

**URL:** https://discuss.elastic.co/t/converting-an-elasticsearch-1-7-compatible-template-into-an-elasticsearch-2-3-template/53838
**Category:** Elasticsearch
**Created:** [June 23, 2016, 9:54pm UTC](https://discuss.elastic.co/t/converting-an-elasticsearch-1-7-compatible-template-into-an-elasticsearch-2-3-template/53838 "2016-06-23T21:54:53Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![John\_D\_Ament](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/john_d_ament/32/764_2.png) [@John\_D\_Ament](https://discuss.elastic.co/u/John_D_Ament)
#### Post date: [June 23, 2016, 9:54pm UTC](https://discuss.elastic.co/t/converting-an-elasticsearch-1-7-compatible-template-into-an-elasticsearch-2-3-template/53838/1 "2016-06-23T21:54:53Z")

</div>

Hi,

So I have this query which works perfectly as a mustache script in ElasticSearch 1.7.

```
{
"_source": [
    "rootRecord.openedDate",
    "rootRecord.typeName",
    "rootRecord.dataFields.Short Desc.",
    "rootRecord.canceled"
],
"sort": [
    "rootRecord.typeName",
    "rootRecord.openedDate"
],
"size" : 1000,
"query": {
    "filtered": {
    "query": {
        "match_all": {}
    },
    "filter": {
        "and": {
        "filters": [
            {
            "range": {
                "rootRecord.openedDate": {
                "from": "{{from}}"
                }
            }
            },
            {
            "bool": {
                "must": {
                "term": {
                    "rootRecord.canceled": "false"
                }
                }
            }
            }
        ]
        }
    }
    }
},
"aggs": {
    "openedMonth": {
    "date_histogram": {
        "field": "rootRecord.openedDate",
        "interval": "month"
    },
    "aggs": {
        "byType": {
        "terms": {
            "field": "_type"
        }
        }
    }
    }
}
}

```

I know there's quite a few things to remove, such as \_source, sort, size, based on the errors received. However even after removing those, I get errors complaining that "rootRecord.openedDate" is not valid, since it has a . in the path. In addition, I get an unknown field on aggs. This is all even though I have valid mappings for these fields.

"properties": {  
"rootRecord": {  
"type": "object",  
"properties": {  
"closedDate": {  
"type": "date"  
},  
"openedDate": {  
"type": "date"  
},  
"canceled": {  
"type": "boolean"  
},  
"typeName": {  
"type": "string"  
},

So I was wondering if I was doing something wrong? Or is there something I'm missing?

John

---

<div class="post-metadata">

### Author: ![John\_D\_Ament](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/john_d_ament/32/764_2.png) [@John\_D\_Ament](https://discuss.elastic.co/u/John_D_Ament)
#### Post date: [June 23, 2016, 9:55pm UTC](https://discuss.elastic.co/t/converting-an-elasticsearch-1-7-compatible-template-into-an-elasticsearch-2-3-template/53838/2 "2016-06-23T21:55:47Z")

</div>

BTW, this is my WIP for the report rewrite

```
{
"query": {
    "bool": {
    "must": [
        {
        "range": {
            "rootRecord.openedDate": {
            "from": "{{from}}"
            }
        }
        },
        {
        "term": {
            "rootRecord.canceled": "false"
        }
        }
    ]
    }
}
}
```

---

<div class="post-metadata">

### Author: ![John\_D\_Ament](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/john_d_ament/32/764_2.png) [@John\_D\_Ament](https://discuss.elastic.co/u/John_D_Ament)
#### Post date: [June 24, 2016, 1:39am UTC](https://discuss.elastic.co/t/converting-an-elasticsearch-1-7-compatible-template-into-an-elasticsearch-2-3-template/53838/3 "2016-06-24T01:39:50Z")

</div>

After looking at it a bit further, I noticed that all of my term queries were showing as deprecated. i rewrote it using the plain java api and they work, so I was wondering am I missing something about them being deprecated?

---

<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: [July 5, 2017, 10:40pm UTC](https://discuss.elastic.co/t/converting-an-elasticsearch-1-7-compatible-template-into-an-elasticsearch-2-3-template/53838/4 "2017-07-05T22:40:55Z")

</div>


