Converting an ElasticSearch 1.7 compatible template into an ElasticSearch 2.3 template

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

BTW, this is my WIP for the report rewrite

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

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?