I have the following query, which works fine in sense against my cluster.
{
"_source": [
"record.opened",
"record.type"
],
"sort": [
{"record.type":"desc"},
"record.opened"
],
"query": {
"filtered": {
"query": {
"match_all": {}
}
}
}
}
It's a straight forward query. I attempted to store this query as a template in my cluster and then invoke it. When I do that, I get an error:
org.elasticsearch.ElasticsearchIllegalArgumentException: Unable to find script in : {
"_source": [
"record.opened",
"record.type"
],
"sort": [
{"record.type":"desc"},
"record.opened"
],
"query": {
"filtered": {
"query": {
"match_all": {}
}
}
}
}
If I change my sort stanza to become
"sort": [
"record.type",
"record.opened"
],
The query works fine as a template. We're on elasticsearch 1.7.3. Any ideas why sorting desc may not work? I've also tried with the explicit order attribute.