Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Remove `body` from the index.update elasticsearch requests (#2777)
Olga Bulatbc84fa0448f6
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.ymlindex a8989a3e8..964b19d4a 100644--- a/.github/workflows/ci_cd.yml+++ b/.github/workflows/ci_cd.yml@@ -304,6 +304,19 @@ jobs:needs:- get-changes- build-images+ strategy:+ fail-fast: false+ matrix:+ name:+ - default+ - es_7+ include:+ - name: default+ version:+ - name: es_7+ version: 7.12.0+ env:+ OPENVERSE_ES_VER: ${{ matrix.version }}steps:- name: Checkout repository@@ -337,6 +350,26 @@ jobs:name: ing_logspath: ingestion_server/test/ingestion_logs.txt+ # This job runs when `test-ing` doesn't and always passes, thus allowing+ # PRs to meet the required checks criteria and be merged.+ bypass-test-ing:+ name: Run tests for ingestion-server+ if: |+ !cancelled() &&+ needs.test-ing.result == 'skipped'+ runs-on: ubuntu-latest+ needs:+ - test-ing+ strategy:+ matrix:+ name:+ - es_current+ - es_7++ steps:+ - name: Pass+ run: echo 'Ingestion server tests are skipped because ingestion server is unchanged.'+######## API ########@@ -352,6 +385,19 @@ jobs:needs:- get-changes- build-images+ strategy:+ fail-fast: false+ matrix:+ name:+ - es_current+ - es_7+ include:+ - name: es_current+ version:+ - name: es_7+ version: 7.12.0+ env:+ OPENVERSE_ES_VER: ${{ matrix.version }}steps:- name: Checkout repository@@ -390,6 +436,26 @@ jobs:name: api_logspath: api_logs+ # This job runs when `test-api` doesn't and always passes, thus allowing+ # PRs to meet the required checks criteria and be merged.+ bypass-test-api:+ name: Run tests for the API+ if: |+ !cancelled() &&+ needs.test-api.result == 'skipped'+ runs-on: ubuntu-latest+ needs:+ - test-api+ strategy:+ matrix:+ name:+ - es_current+ - es_7++ steps:+ - name: Pass+ run: echo 'API tests are skipped because API is unchanged.'+django-checks:name: Run Django checksif: |diff --git a/api/api/apps.py b/api/api/apps.pyindex 700d28efe..462ef47f8 100644--- a/api/api/apps.py+++ b/api/api/apps.py@@ -4,3 +4,6 @@ from django.apps import AppConfigclass ApiConfig(AppConfig):name = "api"default_auto_field = "django.db.models.AutoField"+++# Comment to force CIdiff --git a/api/api/models/media.py b/api/api/models/media.pyindex 4324726ae..5cd795f13 100644--- a/api/api/models/media.py+++ b/api/api/models/media.py@@ -373,7 +373,7 @@ class AbstractMatureMedia(PerformIndexUpdateMixin, models.Model):self._perform_index_update("update",raise_errors,- body={"doc": {"mature": is_mature}},+ doc={"mature": is_mature},)def save(self, *args, **kwargs):diff --git a/api/test/unit/models/test_media_report.py b/api/test/unit/models/test_media_report.pyindex b402451f1..9ca4fb670 100644--- a/api/test/unit/models/test_media_report.py+++ b/api/test/unit/models/test_media_report.py@@ -97,13 +97,13 @@ def test_mature_filtering_creates_mature_image_instance(call(id=media.id,index=media_type,- body={"doc": {"mature": True}},+ doc={"mature": True},refresh=True,),call(id=media.id,index=f"{media_type}-filtered",- body={"doc": {"mature": True}},+ doc={"mature": True},refresh=True,),]@@ -137,25 +137,25 @@ def test_deleting_mature_image_instance_resets_mature_flag(id=media.pk,refresh=True,index=media_type,- body={"doc": {"mature": True}},+ doc={"mature": True},),call(id=media.pk,refresh=True,index=f"{media_type}-filtered",- body={"doc": {"mature": True}},+ doc={"mature": True},),call(id=media.pk,refresh=True,index=media_type,- body={"doc": {"mature": False}},+ doc={"mature": False},),call(id=media.pk,refresh=True,index=f"{media_type}-filtered",- body={"doc": {"mature": False}},+ doc={"mature": False},),],)@@ -323,7 +323,7 @@ def test_mature_media_updates_all_indexes(call(index=index,id=media.id,- body={"doc": {"mature": True}},+ doc={"mature": True},refresh=True,)for index in indexes@@ -359,7 +359,7 @@ def test_mature_media_ignores_elasticsearch_404_errors(call(index=index,id=media.id,- body={"doc": {"mature": True}},+ doc={"mature": True},refresh=True,)for index in indexes@@ -396,7 +396,7 @@ def test_mature_media_reraises_elasticsearch_400_errors(call(index=index,id=media.id,- body={"doc": {"mature": True}},+ doc={"mature": True},refresh=True,)for index in indexesdiff --git a/docker-compose.yml b/docker-compose.ymlindex 22ff17db7..804ce045a 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -192,7 +192,7 @@ services:profiles:- ingestion_server- api- image: docker.elastic.co/elasticsearch/elasticsearch:8.8.2+ image: docker.elastic.co/elasticsearch/elasticsearch:${OPENVERSE_ES_VER:-8.8.2}ports:- "50292:9200"env_file:diff --git a/ingestion_server/gunicorn.conf.py b/ingestion_server/gunicorn.conf.pyindex 842c29b2b..6c8aa5b96 100644--- a/ingestion_server/gunicorn.conf.py+++ b/ingestion_server/gunicorn.conf.py@@ -42,3 +42,5 @@ logconfig_dict = {},}loglevel = "debug"++# Comment to force CI