elastically icon indicating copy to clipboard operation
elastically copied to clipboard

setup misconfiguration

Open dealomuss opened this issue 1 year ago • 1 comments

Hello,

thanks for this bundle ! sounds great

sadly i couldn't manage to set it up i have a "lot" of problem lately the newest error is
Mapping file "/company_mapping.yaml" not found. Please check y
our configuration.

i've followed the tutorial but it seems that my installation of symfony ( i'm using it in symfony ) is just completly ignoring the elastically.yml that i have created in config/packages/elastically.yml

i'm using php cli in docker env

PHP 8.2.20 (cli) (built: Jun 13 2024 02:30:07) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.20, Copyright (c) Zend Technologies

the elastically version installed is "jolicode/elastically": "^1.9",

i had enabled the bundle in bundles.php

return [
    Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
    JoliCode\Elastically\Bridge\Symfony\ElasticallyBundle::class => ['all' => true],

];

when i try to dump elastically config i've got an array to string error

I have no name!@3af6987d9cd3:/app$ bin/console config:dump elastically
# Default configuration for extension with alias: "elastically"
[critical] Error thrown while running command "'config:dump' elastically". Message: "Warning: Array to string conversion"

In YamlReferenceDumper.php line 132:
                                       
  Warning: Array to string conversion  
                                       

config:dump-reference [--format FORMAT] [--] [<name> [<path>]]

also i have to declare and re alias manually the services in my own services.yml with the following declaration

    elastically.default.client:
        class: JoliCode\Elastically\Client
    JoliCode\Elastically\Client: '@elastically.default.client'
    JoliCode\Elastically\IndexBuilder : '@elastically.default.index_builder'
    JoliCode\Elastically\Indexer: '@elastically.default.indexer'

i think i've missed something during installation because there are way too much problem here

anyhelp would be appreciated

here's my composer.json content

{
    "type": "project",
    "license": "proprietary",
    "minimum-stability": "stable",
    "prefer-stable": true,
    "require": {
        "php": ">=7.2.5",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "jolicode/elastically": "^1.9",
        "ruflin/elastica": "*",
        "symfony/console": "5.4.*",
        "symfony/dotenv": "5.4.*",
        "symfony/flex": "^1.17|^2",
        "symfony/framework-bundle": "5.4.*",
        "symfony/runtime": "5.4.*",
        "symfony/yaml": "5.4.*"
    },
    "config": {
        "allow-plugins": {
            "composer/package-versions-deprecated": true,
            "php-http/discovery": true,
            "symfony/flex": true,
            "symfony/runtime": true
        },
        "optimize-autoloader": true,
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "5.4.*"
        }
    }
}

thanks in advance

dealomuss avatar Jul 01 '24 17:07 dealomuss

What PHP version are you using ? and what is the installed version of elastically?

lyrixx avatar Jul 02 '24 14:07 lyrixx

Hi! Thanks for the report, I may have found the issue, PR in progress: https://github.com/jolicode/elastically/pull/189

damienalexandre avatar Jul 12 '24 13:07 damienalexandre

glad to know ! i've moved with the elastica bundle meanwhile @lyrixx PHP 8.2.20 (cli) (built: Jun 13 2024 02:30:07) (NTS) & elastically "jolicode/elastically": "^1.9" as i mentioned above

:)

dealomuss avatar Jul 12 '24 14:07 dealomuss

It's released in v1.9.1 :wave:

damienalexandre avatar Jul 12 '24 14:07 damienalexandre

Hi, I have the same problem with elastically 1.9.0 or 1.9.1. When I try to create the index I have this error (following the tutorial "Elasticsearch the right way in Symfony") :

In YamlProvider.php line 37:

  Mapping file "/land-registry_mapping.yaml" not found. Please check your configuration.

Here is my config/packages/elastically.yaml :

elastically:
    connections:
        default:
            client:
                host:                '%env(ELASTICSEARCH_HOST)%'
                # If you want to use the Symfony HttpClient (you MUST create this service)
                #transport:           'JoliCode\Elastically\Transport\HttpClientTransport'

            # Path to the mapping directory (in YAML)
            mapping_directory:       '%kernel.project_dir%/config/elasticsearch'

            # Size of the bulk sent to Elasticsearch (default to 100)
            bulk_size:               100

            # Mapping between an index name and a FQCN
            index_class_mapping:
                land-registry:     App\Model\Location\LandRegisty

            # Configuration for the serializer
            serializer:
                # Fill a static context
                context_mapping:
                    foo:                 bar

            # If you want to add a prefix for your index in elasticsearch (you can still call it by its base name everywhere!)
            # prefix: '%kernel.environment%'

I'm using Symfony 7.0.6 with PHP 8.2.21

EOL-Fred avatar Jul 17 '24 15:07 EOL-Fred