Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup misconfiguration #187

Closed
dealomuss opened this issue Jul 1, 2024 · 5 comments
Closed

setup misconfiguration #187

dealomuss opened this issue Jul 1, 2024 · 5 comments

Comments

@dealomuss
Copy link

dealomuss commented Jul 1, 2024

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

@lyrixx
Copy link
Member

lyrixx commented Jul 2, 2024

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

@damienalexandre
Copy link
Member

Hi! Thanks for the report, I may have found the issue, PR in progress: #189

@dealomuss
Copy link
Author

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

:)

@damienalexandre
Copy link
Member

It's released in v1.9.1 👋

@EOL-Fred
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants