Closed snackerphi closed 1 year ago
Hello @snackerphi thanks for reporting this. From our API docs, when getting the list of indexes the response object has this description for ddoc
field:
When getting and deleting an index, the description for ddoc
states that the string should not contain _design
prefix:
It's working as expected but we will update getIndexesInformation
response description to make it clear that ddoc
includes a _design
prefix.
OK, thanks!
Describe the bug
To delete an index, the
Cloudant::deleteIndex(... .ddoc( ii.getDdoc() ) ...)
is sending:DELETE /my_foo-db/_index/_design/_design%2F8a49ddc19c9f8084e81ff8783637b1b30fea460f/json/my_foo-db_name_idx HTTP/1.1
However, according to CouchDB DELETE index, it should be:DELETE /my_foo-db/_index/8a49ddc19c9f8084e81ff8783637b1b30fea460f/json/my_foo-db_name_idx HTTP/1.1
To Reproduce
List<IndexesInformation> rii cloudant.getIndexesInformation(...)
rii
to determine if there is an index that needs to be deleted.IndexInformation ii = rii.get( ... );
that needs to be deleted.Response<Ok> ro = cloudant.deleteIndex( new DeleteIndexOptions.Builder() .db( dbName ) .index( idxName ) .ddoc( ii.getDdoc() ) .type( ii.getType() ) .build() ).execute();
com.ibm.cloud.sdk.core.service.exception.NotFoundException: not_found
Using curl:
curl -X DELETE 'http://localhost:5983/my_foo-db/_index/_design/8a49ddc19c9f8084e81ff8783637b1b30fea460f/json/my_foo-db_name_idx' -H 'Authorization: Basic YWJjOjEyMw==' -v
curl -X DELETE 'http://localhost:5983/my_foo-db/_index/_design/_design%2F8a49ddc19c9f8084e81ff8783637b1b30fea460f/json/my_foo-db_name_idx' -H 'Authorization: Basic YWJjOjEyMw==' -v
Expected behavior
HTTP 200 OK
Screenshots
Must gather (please complete the following information):
Additional context
Changing
.ddoc( ii.getDdoc() )
to.ddoc( ii.getDdoc().replaceFirst( "^_design/", "" ) )
will work.Is this the way it is expected to work?