"error":"no_usable_index", "reason":"No index exists for this sort, try indexing by the sort fields." #2971
-
DescriptionI followed the instructions in the documentation for POST /{db}/_find, but that doesn't work for me Current BehaviourI have a database "views" with different documents. I want to find documents using a declarative JSON querying syntax, i try with the example query in the documentation:
For me i use the below query:
But CouchDB responded with: Expected BehaviourWhen i query CouchDB would response with:
Your Environment
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Did you try creating an index on the sort fields as the output suggested? That would be using this endpoint. |
Beta Was this translation helpful? Give feedback.
-
Thank you! This is the answer. |
Beta Was this translation helpful? Give feedback.
-
I've experienced the same problem, but only with curl -X POST "$SERVICE_URL/$DB/_index" --data '{
"ddoc": "text-index",
"index": {
"fields": [{
"name": "name",
"type": "string"
}]
},
"name": "getUserByName",
"type": "text"
}' I wanted to sort based on
A document that this query shall return:
Current behaviour
Expected behaviour
EnvironmentI've used CouchDB "version":"3.2.0","git_sha":"efb409bba" (apache/couchdb docker image) Additional contextIf I add curl -X POST "$SERVICE_URL/$DB/_index" --data '{
"ddoc": "text-index",
"index": {
"fields": [{
"name": "name",
"type": "string"
},
{
"name": "email_verified",
"type": "boolean"
}]
},
"name": "getUserByName",
"type": "text"
}' Why I have to define |
Beta Was this translation helpful? Give feedback.
Did you try creating an index on the sort fields as the output suggested?
That would be using this endpoint.