Is there a way to include a CouchDB index JSON configuration in the ddocs for CHT to process?
We’ve experimented with creating an index via Fauxton and using a curl
command, but we believe these configurations should be tracked in the app repository rather than managed separately.
Since CHT views are already tracked within the ddocs
folder, we were wondering if the same approach could be used for index configurations.
For reference, here is the index we want to create:
{
"index": {
"fields": ["_id", "type"],
"partial_filter_selector": {
"type": { "$nin": ["form", "translations", "meta"] },
"_id": { "$nin": ["branding", "extension-libs", "resources"] }
}
},
"ddoc": "testing_by_id_and_type",
"name": "testing_by_id_and_type",
"type": "json",
}
Relevant documentation:
Curl command:
curl -X POST http://admin:password@localhost:5984/medic/_index \
-H "Content-Type: application/json" \
-d '{
"index": {
"fields": ["_id", "type"],
"partial_filter_selector": {
"type": { "$nin": ["form", "translations", "meta"] },
"_id": { "$nin": ["branding", "extension-libs", "resources"] }
}
},
"ddoc": "testing_by_id_and_type",
"name": "testing_by_id_and_type",
"type": "json"
}'
Output:
{"result":"created","id":"_design/testing_by_id_and_type","name":"testing_by_id_and_type"}