php - Elasticsearch throwing http method exceptions. Symfony 4.4 on Platform.sh

one text

I'm using the FOS Elasticsearch bundle on Symfony 4.4 on Platform.sh and any attempt to populate results in error.

Relevant config pieces:

composer.json

"require": {
    "php": ">=7.3.0",
    ...
    "friendsofsymfony/elastica-bundle": "^5.1",

platform/services.yml

searchelastic77:
    type: elasticsearch:7.7
    disk: 1024

.platform.app.yml

relationships:
    ...
    elasticsearch: "searchelastic77:elasticsearch"

config/packages/fos_elastica.yml

fos_elastica:
    clients:
        default: { url: '%env(ELASTICSEARCH_URL)%' }
    indexes:
        app_post:
            types:
                post:
                    properties:
                        title: ~
                        excerpt: ~
                        content: ~
                        author: ~
                    persistence:
                        driver: orm
                        model: App\Entity\Post
                        provider: ~
                        finder: ~

.env

###> friendsofsymfony/elastica-bundle ###
ELASTICSEARCH_URL=http://localhost:9200/
###< friendsofsymfony/elastica-bundle ###

In the platform.sh settings for this branch, I have the following variable configured:

env:ELASTICSEARCH_URL = http://elasticsearch.internal:9200

running platform:relationships on this branch yields:

elasticsearch:
    -
        service: searchelastic77
        ip: ***
        cluster: ***
        host: elasticsearch.internal
        rel: elasticsearch
        scheme: http
        port: 9200
        url: 'http://elasticsearch.internal:9200'

The Error seems to have to do with incorrect HTTP methods. Attempting to populate the index on the live server by running the command bin/console fos:elastica:populate yields the following exception:

Resetting app_post

In Http.php line 182:
                                                                                    
  Incorrect HTTP method for uri [/] and method [PUT], allowed: [GET, DELETE, HEAD]  
                                                                                    

fos:elastica:populate [--index [INDEX]] [--type [TYPE]] [--no-reset] [--no-delete] [--sleep SLEEP] [--ignore-errors] [--no-overwrite-format] [--first-page FIRST-PAGE] [--last-page LAST-PAGE] [--max-per-page MAX-PER-PAGE] [--pager-persister PAGER-PERSISTER] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

Attempting to update post entity on the production server also yields this error:

request.CRITICAL: Uncaught PHP Exception Elastica\Exception\ResponseException: "Incorrect HTTP method for uri [/] and method [POST], allowed: [GET, DELETE, HEAD]" at /app/vendor/ruflin/elastica/lib/Elastica/Transport/Http.php line 182 {"exception":"[object] (Elastica\\Exception\\ResponseException(code: 0): Incorrect HTTP method for uri [/] and method [POST], allowed: [GET, DELETE, HEAD] at /app/vendor/ruflin/elastica/lib/Elastica/Transport/Http.php:182)"} []

I have tried various combinations of Elastic search versions (5.2, 6.5 and now 7.7) and all are throwing the same errors.

Source