The problem I am facing is on creating the correct index to query through my Cloudant database. The JSON data structure I am using looks similar to below.
{
"customer" : "123",
"time" : "2014-11-20"
}
I want to sort the documents based on the time. The index query that I used is:
curl -X POST 'https://<user>:<pass>@<user>.cloudant.com/<DB-name>/_index' -d '
{
"index": {
"fields": [
"customer",
"time"
]
}
}'
And the Query that I am using is:
curl -X POST 'https://<user>:<pass>@<user>.cloudant.com/<DB-name>/_find' -d '
{
"selector": {
"customer" : "123"
},
"sort": [
"time"
]
}'
The error code I am getting is "no_usable_index". Can anyone provide some insight into this problem?
Also, what would be different if the time were in the format: "2014-11-20 11:50:00"? Essentially, I am trying to sort based on date and time. Is this possible?