Hey Amit, everything went well with the UpdateIndexMapping command:
(cchq) ccc@monolith:~/commcare-cloud$ cchq monolith django-manage shell
[WARNING]: While constructing a mapping from <string>, line 105, column 3, found a duplicate dict key (ELASTICSEARCH_MAJOR_VERSION). Using last defined value only.
ssh ccc@10.3.0.4 -t -o UserKnownHostsFile=/home/ccc/environments/monolith/known_hosts 'sudo -iu cchq bash -c '"'"'cd /home/cchq/www/monolith/current; python_env/bin/python manage.py shell'"'"''
Ubuntu 22.04.5 LTS
Python 3.13.3 (main, Apr 9 2025, 04:03:52) [Clang 20.1.0 ]
Type 'copyright', 'credits' or 'license' for more information
IPython 9.3.0 -- An enhanced Interactive Python. Type '?' for help.
Tip: You can use Ctrl-O to force a new line in terminal IPython
In [1]: from corehq.apps.es.migration_operations import UpdateIndexMapping
...: from corehq.apps.es.transient_util import iter_doc_adapters
...:
In [2]: for adapter in iter_doc_adapters():
...: print(adapter.index_name, adapter.type)
...: UpdateIndexMapping(name=adapter.index_name, type_=adapter.type, properties=adapter.mapping['properties'], es_versions=[6]).run()
...:
apps-2024-05-09 app
2025-09-20 18:09:03,926 INFO [corehq.apps.es.migration_operations] Updating mappings for Elasticsearch index: apps-2024-05-09
--- before.py
+++ after.py
@@ -3,7 +3,7 @@
"enabled": False
},
"_meta": {
- "created": "2024-06-06T03:49:00.431884"
+ "created": "2025-09-20T18:09:03.926871"
},
"date_detection": False,
"dynamic": "false",
cases-2024-05-09 case
2025-09-20 18:09:04,031 INFO [corehq.apps.es.migration_operations] Updating mappings for Elasticsearch index: cases-2024-05-09
--- before.py
+++ after.py
@@ -3,7 +3,7 @@
"enabled": True
},
"_meta": {
- "created": "2024-06-06T03:49:00.795386"
+ "created": "2025-09-20T18:09:04.031830"
},
"date_detection": False,
"dynamic": "false",
case-search-2024-05-09 case
2025-09-20 18:09:04,087 INFO [corehq.apps.es.migration_operations] Updating mappings for Elasticsearch index: case-search-2024-05-09
--- before.py
+++ after.py
@@ -3,7 +3,7 @@
"enabled": False
},
"_meta": {
- "created": "2024-06-06T03:49:00.618525"
+ "created": "2025-09-20T18:09:04.087859"
},
"date_detection": False,
"dynamic": "false",
domains-2024-05-09 hqdomain
2025-09-20 18:09:04,138 INFO [corehq.apps.es.migration_operations] Updating mappings for Elasticsearch index: domains-2024-05-09
--- before.py
+++ after.py
@@ -3,7 +3,7 @@
"enabled": False
},
"_meta": {
- "created": "2024-06-06T03:49:00.989325"
+ "created": "2025-09-20T18:09:04.138262"
},
"date_detection": False,
"dynamic": "false",
forms-2024-05-09 xform
2025-09-20 18:09:04,206 INFO [corehq.apps.es.migration_operations] Updating mappings for Elasticsearch index: forms-2024-05-09
--- before.py
+++ after.py
@@ -3,7 +3,7 @@
"enabled": True
},
"_meta": {
- "created": "2024-06-06T03:49:01.177468"
+ "created": "2025-09-20T18:09:04.206554"
},
"date_detection": False,
"dynamic": "false",
groups-2024-05-09 group
2025-09-20 18:09:04,259 INFO [corehq.apps.es.migration_operations] Updating mappings for Elasticsearch index: groups-2024-05-09
--- before.py
+++ after.py
@@ -3,7 +3,7 @@
"enabled": True
},
"_meta": {
- "created": "2024-06-06T03:49:01.372528"
+ "created": "2025-09-20T18:09:04.259255"
},
"date_detection": False,
"dynamic": "false",
sms-2024-05-09 sms
2025-09-20 18:09:04,302 INFO [corehq.apps.es.migration_operations] Updating mappings for Elasticsearch index: sms-2024-05-09
--- before.py
+++ after.py
@@ -3,7 +3,7 @@
"enabled": False
},
"_meta": {
- "created": "2024-06-06T03:49:01.552646"
+ "created": "2025-09-20T18:09:04.301986"
},
"date_detection": False,
"dynamic": "false",
users-2024-05-09 user
2025-09-20 18:09:04,357 INFO [corehq.apps.es.migration_operations] Updating mappings for Elasticsearch index: users-2024-05-09
--- before.py
+++ after.py
@@ -4,7 +4,7 @@
"enabled": True
},
"_meta": {
- "created": "2025-05-15T03:52:06.776539"
+ "created": "2025-09-20T18:09:04.357302"
},
"date_detection": False,
"dynamic": "false",
@@ -454,6 +454,44 @@
}
}
},
+ "user_domain_memberships": {
+ "dynamic": "false",
+ "type": "nested",
+ "properties": {
+ "assigned_location_ids": {
+ "type": "keyword"
+ },
+ "doc_type": {
+ "type": "keyword"
+ },
+ "domain": {
+ "fields": {
+ "exact": {
+ "type": "keyword"
+ }
+ },
+ "type": "text"
+ },
+ "is_active": {
+ "type": "boolean"
+ },
+ "is_admin": {
+ "type": "boolean"
+ },
+ "location_id": {
+ "type": "keyword"
+ },
+ "override_global_tz": {
+ "type": "boolean"
+ },
+ "role_id": {
+ "type": "keyword"
+ },
+ "timezone": {
+ "type": "text"
+ }
+ }
+ },
"user_location_id": {
"type": "keyword"
},
But when I run ./manage.py migrate it reports:
(commcare-hq) (monolith) cchq@monolith:~/www/monolith/current$ ./manage.py migrate
Operations to perform:
Apply all migrations: accounting, admin, aggregate_ucrs, analytics, api, app_execution, app_manager, auditcare, auth, blobs, campaign, case_importer, case_search, cleanup, cloudcare, commtrack, consumption, contenttypes, couchforms, custom_data_fields, data_analytics, data_cleaning, data_dictionary, data_interfaces, dhis2, django_celery_results, django_digest, django_prbac, domain, domain_migration_flags, dropbox, email, enterprise, es, events, experiments, export, fhir, field_audit, fixtures, form_processor, formplayer_api, generic_inbound, geospatial, hqadmin, hqmedia, hqwebapp, integration, ip_access, ivr, linked_domain, locations, mobile_auth, motech, notifications, oauth2_provider, ota, otp_static, otp_totp, phone, phonelog, phonenumber, pillow_retry, pillowtop, preindex, products, project_limits, registration, registry, reminders, repeaters, reports, saved_reports, scheduling, scheduling_partitioned, sessions, sites, sms, smsbillables, smsforms, sql_accessors, sql_proxy_accessors, sql_proxy_standby_accessors, sso, start_enterprise, stock, tastypie, telerivet, toggle_ui, toggles, translations, user_importer, userreports, users, util, zapier
Running migrations:
No migrations to apply.
Attempting to deploy Merge pull request #36980 from dimagi/create-pull-request/update-tran… · dimagi/commcare-hq@3a8f328 · GitHub results in another DB migration error, this time it seems related to CouchDB:
Claude.ai reports this after parsing the error:
The migration failed due to a missing CouchDB view in the
users_by_domaindesign document. Here's what happened:Root Cause: The migration script tried to access a CouchDB view at:
_design/users_by_domain/_view/viewBut received a 404 error, indicating this view doesn't exist in the database.
At this stage I’m not sure if it’s safe to restore the snapshot prior to this attempted deployment or if I should go back to the snapshot prior to the ES 6 upgrade again.