Elasticsearch can't index big ACLs
If you try to update the event or series ACL with a huge ruleset, at some point you will see a message like this in the log output:
`Document contains at least one immense term in field="access_policy" (whose UTF8 encoding is longer than the max length 32766), all of which were skipped.  Please correct the analyzer to not produce such terms.`
The ACL changes aren't shown in the admin UI. But if you run an index rebuild, you will see the same message againg and the event/series metadata will be empty.

The message does mean, that the elastic index field for access policy can contain at least 32766 byte values. You have exceed this limit. To index such a big ACLs we need to change the type of the `access_policy` field to `text`.

diff --git a/docs/guides/admin/docs/upgrade.md b/docs/guides/admin/docs/upgrade.md
index 8f656de17f..edcf4d7b77 100644
--- a/docs/guides/admin/docs/upgrade.md
+++ b/docs/guides/admin/docs/upgrade.md
@@ -11,5 +11,8 @@ How to Upgrade
 2. Replace Opencast with the new version
 3. Back-up Opencast files and database (optional)
 4. [Upgrade the database](#database-migration)
+5. Remove search index data folder
+6. Start Opencast
+7. Rebuild Admin UI and External API index
 
 You can find the database upgrade script in `docs/upgrade/7_to_8/`.
diff --git a/modules/index-service/src/main/java/org/opencastproject/index/service/impl/index/event/EventIndexUtils.java b/modules/index-service/src/main/java/org/opencastproject/index/service/impl/index/event/EventIndexUtils.java
index 4d334da717..07398106b9 100644
--- a/modules/index-service/src/main/java/org/opencastproject/index/service/impl/index/event/EventIndexUtils.java
+++ b/modules/index-service/src/main/java/org/opencastproject/index/service/impl/index/event/EventIndexUtils.java
@@ -183,7 +183,7 @@ public final class EventIndexUtils {
     }
 
     if (StringUtils.isNotBlank(event.getAccessPolicy())) {
-      metadata.addField(EventIndexSchema.ACCESS_POLICY, event.getAccessPolicy(), true);
+      metadata.addField(EventIndexSchema.ACCESS_POLICY, event.getAccessPolicy(), false);
       addAuthorization(metadata, event.getAccessPolicy());
     }
 
diff --git a/modules/index-service/src/main/java/org/opencastproject/index/service/impl/index/series/SeriesIndexUtils.java b/modules/index-service/src/main/java/org/opencastproject/index/service/impl/index/series/SeriesIndexUtils.java
index f934b42507..75a0b14771 100644
--- a/modules/index-service/src/main/java/org/opencastproject/index/service/impl/index/series/SeriesIndexUtils.java
+++ b/modules/index-service/src/main/java/org/opencastproject/index/service/impl/index/series/SeriesIndexUtils.java
@@ -133,7 +133,7 @@ public final class SeriesIndexUtils {
     }
 
     if (StringUtils.trimToNull(series.getAccessPolicy()) != null) {
-      metadata.addField(SeriesIndexSchema.ACCESS_POLICY, series.getAccessPolicy(), true);
+      metadata.addField(SeriesIndexSchema.ACCESS_POLICY, series.getAccessPolicy(), false);
       addAuthorization(metadata, series.getAccessPolicy());
     }
 
diff --git a/modules/search/src/main/resources/elasticsearch/event-mapping.json b/modules/search/src/main/resources/elasticsearch/event-mapping.json
index 01dfec8ec4..b258734c36 100644
--- a/modules/search/src/main/resources/elasticsearch/event-mapping.json
+++ b/modules/search/src/main/resources/elasticsearch/event-mapping.json
@@ -56,7 +56,7 @@
 
             "rights": { "type" : "keyword" },
 
-            "access_policy": { "type" : "keyword" },
+            "access_policy": { "type" : "text", "index" : false, "store" : false },
 
             "managed_acl": { "type" : "keyword" },
 
diff --git a/modules/search/src/main/resources/elasticsearch/series-mapping.json b/modules/search/src/main/resources/elasticsearch/series-mapping.json
index d658ca9bb5..b40a823c5b 100644
--- a/modules/search/src/main/resources/elasticsearch/series-mapping.json
+++ b/modules/search/src/main/resources/elasticsearch/series-mapping.json
@@ -24,7 +24,7 @@
 
             "license": { "type" : "keyword" },
 
-            "access_policy": { "type" : "keyword" },
+            "access_policy": { "type" : "text", "index" : false, "store" : false },
 
             "managed_acl": { "type" : "keyword" },
 
diff --git a/modules/search/src/main/resources/elasticsearch/version-mapping.json b/modules/search/src/main/resources/elasticsearch/version-mapping.json
index 792bffd4d8..b45e7b2bc0 100644
--- a/modules/search/src/main/resources/elasticsearch/version-mapping.json
+++ b/modules/search/src/main/resources/elasticsearch/version-mapping.json
@@ -6,7 +6,7 @@
     "properties": {
       "version": {
         "type": "integer",
-        "index": "not_analyzed"
+        "index": false
       }
     }
   }
diff --git a/modules/search/src/test/resources/elasticsearch/content-mapping.json b/modules/search/src/test/resources/elasticsearch/content-mapping.json
index d3acbf6eaf..b1a48f069d 100644
--- a/modules/search/src/test/resources/elasticsearch/content-mapping.json
+++ b/modules/search/src/test/resources/elasticsearch/content-mapping.json
@@ -2,7 +2,7 @@
 	"content" : {
 	    "_source" : { "enabled" : false },
 	    "properties" : {
-	        "title" : { "type" : "string", "index" : "analyzed" }
+	        "title" : { "type" : "text", "index" : true }
 	    }
 	}
 }
\ No newline at end of file
diff --git a/modules/search/src/test/resources/elasticsearch/version-mapping.json b/modules/search/src/test/resources/elasticsearch/version-mapping.json
index 747fd59bab..5e157ed5d2 100644
--- a/modules/search/src/test/resources/elasticsearch/version-mapping.json
+++ b/modules/search/src/test/resources/elasticsearch/version-mapping.json
@@ -2,7 +2,7 @@
 	"version" : {
 	    "_source" : { "enabled" : false },
 	    "properties" : {
-	        "version" : { "type" : "integer", "index" : "not_analyzed" }
+	        "version" : { "type" : "integer", "index" : false }
 	    }
 	}
 }
\ No newline at end of file
['modules/index-service/src/main/java/org/opencastproject/index/service/impl/index/event/EventIndexUtils.java', 'modules/search/src/main/resources/elasticsearch/event-mapping.json', 'modules/search/src/main/resources/elasticsearch/version-mapping.json', 'modules/search/src/test/resources/elasticsearch/version-mapping.json', 'modules/search/src/test/resources/elasticsearch/content-mapping.json', 'modules/search/src/main/resources/elasticsearch/series-mapping.json', 'modules/index-service/src/main/java/org/opencastproject/index/service/impl/index/series/SeriesIndexUtils.java', 'docs/guides/admin/docs/upgrade.md']