FriendsOfSymfony / FOSElasticaBundle

Elasticsearch PHP integration for your Symfony project using Elastica.
http://friendsofsymfony.github.io
MIT License
1.25k stars 793 forks source link

Simple Config: [Elastica\Exception\ResponseException] #641

Closed fdrechsler closed 10 years ago

fdrechsler commented 10 years ago

i installed FOSElastica 3.0 with Composer to my Symfony Project. This is my Config:

fos_elastica:
    clients:
        default: { host: localhost, port: 9200 }
    indexes:
        search:
          types:
            keyword:
                mappings:
                    value:
                      type: string
                persistence:
                    driver: orm
                    model: Anklick\UserPagesBundle\Entity\Keyword
                    provider: ~
                    listener:
                        immediate: ~
                    finder: ~

Pretty simple huh?

Now when i do php app/console fos:elastica:populate

It says me:

Resetting search

[Elastica\Exception\ResponseException]
ClassCastException[java.util.ArrayList cannot be cast to java.util.Map]

Whats the Problem?

EDIT: With 2.1.x everything works fine.

maguramarkian commented 10 years ago

what version of elastica you have? http://localhost:9200/

merk commented 10 years ago

Please paste the output from composer show -i

fdrechsler commented 10 years ago

"version" : { "number" : "1.2.0", "build_hash" : "c82387f290c21505f781c695f365d0ef4098b272", "build_timestamp" : "2014-05-22T12:49:13Z", "build_snapshot" : false, "lucene_version" : "4.8" },

composer show -i I installed 2.1.x now, it works with it.

braincrafted/bootstrap-bundle            v2.0.1             BraincraftedBootstrapBundle integrates Bootstrap into Symfony2 by providing templates, Twig extensions, services and commands.
doctrine/annotations                     v1.1.2             Docblock Annotations Parser
doctrine/cache                           v1.3.0             Caching library offering an object-oriented API for many cache backends
doctrine/collections                     v1.2               Collections Abstraction library
doctrine/common                          v2.4.2             Common Library for Doctrine projects
doctrine/dbal                            v2.4.2             Database Abstraction Layer
doctrine/doctrine-bundle                 v1.2.0             Symfony DoctrineBundle
doctrine/inflector                       v1.0               Common String Manipulations with regard to casing and singular/plural rules.
doctrine/lexer                           v1.0               Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/orm                             v2.4.3             Object-Relational-Mapper for PHP
friendsofsymfony/elastica-bundle         v2.1.3-PL1         Elasticsearch PHP integration for your Symfony2 project using Elastica
friendsofsymfony/user-bundle             dev-master 71ed250 Symfony FOSUserBundle
gedmo/doctrine-extensions                dev-master de89aae Doctrine2 behavioral extensions
incenteev/composer-parameter-handler     v2.1.0             Composer script handling your ignored parameter file
jdorn/sql-formatter                      v1.2.17            a PHP SQL highlighting library
knplabs/knp-menu                         dev-master 532a4ad An object oriented menu library
knplabs/knp-menu-bundle                  dev-master e6a0756 This bundle provides an integration of the KnpMenu library
kriswallsmith/assetic                    v1.1.2             Asset Management for PHP
monolog/monolog                          1.10.0             Sends your logs to files, sockets, inboxes, databases and various web services
psr/log                                  1.0.0              Common interface for logging libraries
ruflin/elastica                          v0.19.8.0          Elasticsearch Client
sensio/distribution-bundle               v2.3.4             The base bundle for the Symfony Distributions
sensio/framework-extra-bundle            v3.0.1             This bundle provides a way to configure your controllers with annotations
sensio/generator-bundle                  v2.3.5             This bundle generates code for you
sonata-project/admin-bundle              dev-master cfc6c90 Symfony SonataAdminBundle
sonata-project/block-bundle              2.2.12             Symfony SonataBlockBundle
sonata-project/cache                     1.0.3              Cache library
sonata-project/core-bundle               dev-master fdeb39d Symfony SonataCoreBundle
sonata-project/doctrine-orm-admin-bundle dev-master 2705f19 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/exporter                  1.3.3              Lightweight Exporter library
stof/doctrine-extensions-bundle          dev-master 3825a4a Integration of the gedmo/doctrine-extensions with Symfony2
swiftmailer/swiftmailer                  v5.2.1             Swiftmailer, free feature-rich PHP mailer
symfony/assetic-bundle                   v2.3.0             Integrates Assetic into Symfony2
symfony/icu                              v1.2.1             Contains an excerpt of the ICU data and classes to load it.
symfony/monolog-bundle                   v2.6.0             Symfony MonologBundle
symfony/swiftmailer-bundle               v2.3.7             Symfony SwiftmailerBundle
symfony/symfony                          v2.5.0             The Symfony PHP framework
twig/extensions                          v1.0.1             Common additional features for Twig that do not directly belong in core
twig/twig                                v1.15.1            Twig, the flexible, fast, and secure template language for PHP
merk commented 10 years ago

I need the output from your set up that isnt working, not the one that is

Seklfreak commented 10 years ago

I have the same problem. config.yml:

fos_elastica:
    clients:
        default: { host: %elasticsearch.host%, port: %elasticsearch.port% }
    indexes:
        wovie:
            client: default
            types:
                Media:
                    mappings:
                        id: ~
                        title: ~
                        description: ~
                        createdBy:
                            type: "nested"
                            properties:
                                id: ~
                    persistence:
                        driver: orm
                        model: SLMN\Wovie\MainBundle\Entity\Media
                        provider: ~
                        listener:
                            immediate: ~
                        finder: ~

http://localhost:9200/:

"version" : {
    "number" : "1.2.1",
    "build_hash" : "6c95b759f9e7ef0f8e17f77d850da43ce8a4b364",
    "build_timestamp" : "2014-06-03T15:02:52Z",
    "build_snapshot" : false,
    "lucene_version" : "4.8"
},

composer show -i:

doctrine/annotations                 v1.1.2             Docblock Annotations Parser
doctrine/cache                       v1.3.0             Caching library offering an object-oriented API for many cache backends
doctrine/collections                 v1.2               Collections Abstraction library
doctrine/common                      v2.4.2             Common Library for Doctrine projects
doctrine/dbal                        v2.4.2             Database Abstraction Layer
doctrine/doctrine-bundle             v1.2.0             Symfony DoctrineBundle
doctrine/inflector                   v1.0               Common String Manipulations with regard to casing and singular/plural rules.
doctrine/lexer                       v1.0               Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/orm                         v2.4.3             Object-Relational-Mapper for PHP
fortawesome/font-awesome             4.1.0              The iconic font and CSS framework
friendsofsymfony/elastica-bundle     v3.0.0-alpha6      Elasticsearch PHP integration for your Symfony2 project using Elastica
friendsofsymfony/jsrouting-bundle    1.5.3              A pretty nice way to expose your Symfony2 routing to client applications.
incenteev/composer-parameter-handler v2.1.0             Composer script handling your ignored parameter file
ircmaxell/password-compat            1.0.3              A compatibility library for the proposed simplified password hashing algorithm: https://w...
jdorn/sql-formatter                  v1.2.17            a PHP SQL highlighting library
kriswallsmith/assetic                v1.1.2             Asset Management for PHP
monolog/monolog                      1.10.0             Sends your logs to files, sockets, inboxes, databases and various web services
oldsound/rabbitmq-bundle             v1.5.0             Integrates php-amqplib with Symfony2 and RabbitMq
predis/predis                        v0.8.5             Flexible and feature-complete PHP client library for Redis
psr/log                              1.0.0              Common interface for logging libraries
ruflin/elastica                      v1.2.1.0           Elasticsearch Client
sekl/main/foundationbundle           dev-master 6670092 Zurb Foundation Bundle
sekl/main/userbundle                 dev-master 327ac7f User Bundle
sensio/distribution-bundle           v2.3.4             The base bundle for the Symfony Distributions
sensio/framework-extra-bundle        v3.0.1             This bundle provides a way to configure your controllers with annotations
sensio/generator-bundle              v2.3.5             This bundle generates code for you
snc/redis-bundle                     1.1.8              A Redis bundle for Symfony2
stripe/stripe-php                    v1.16.0            Stripe PHP Library
swiftmailer/swiftmailer              v5.2.1             Swiftmailer, free feature-rich PHP mailer
symfony/assetic-bundle               v2.3.0             Integrates Assetic into Symfony2
symfony/icu                          v1.2.1             Contains an excerpt of the ICU data and classes to load it.
symfony/monolog-bundle               v2.6.0             Symfony MonologBundle
symfony/swiftmailer-bundle           v2.3.7             Symfony SwiftmailerBundle
symfony/symfony                      v2.5.0             The Symfony PHP framework
tecnick.com/tcpdf                    6.0.087            TCPDF is a PHP class for generating PDF documents.
tijsverkoyen/css-to-inline-styles    1.2.1              CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages...
twig/extensions                      v1.0.1             Common additional features for Twig that do not directly belong in core
twig/twig                            v1.15.1            Twig, the flexible, fast, and secure template language for PHP
videlalvaro/php-amqplib              v2.4.0             This library is a pure PHP implementation of the AMQP protocol. It's been tested against ...
webfactory/exceptions-bundle         4.0.0              A simple controller to display error pages during development plus some building blocks f...
willdurand/jsonp-callback-validator  v1.1.0             JSONP callback validator.
zurb/foundation                      v5.3.0             The most advanced responsive front-end framework in the world.

Same error.

merk commented 10 years ago

Some things have been fixed after alpha6, use ~3.0@dev for now (until we mark 3.0.0 stable)

Seklfreak commented 10 years ago

That worked. Thanks!

fdrechsler commented 10 years ago

Thanks, worked.