-2

When I index my relationnal database (Postgresql), I want to get the string value intead of the foreign key id (recreate the relation between the two tables personn and country..) I wish to do that in the fos_elastica.yml mapping file

Example:

fos_elastica:
    clients:
        default: { host: %elastic_host%, port: %elastic_port% }
    indexes:
        ex_app:
            client: default
            types:
                personn:
                    mappings:
                        id:
                            type: integer
                        name:
                            type: text
                            boost: 5
                        firstname:
                            type: text
                            boost: 3
                        dateofbirth:
                            type: date
                        country:
                            type: integer
                    persistence:
                        driver: orm
                        model: AppBundle\Entity\Personn
                        finder: ~
                        provider: ~
                        listener: ~

I want to find the person by typing the name of the country and not the country id.

htm
  • 1
  • 1

1 Answers1

0

I'm pretty sure that you should use "nested" :

fos_elastica:
        clients:
            default: { host: %elastic_host%, port: %elastic_port% }
        indexes:
            ex_app:
                client: default
                types:
                    personn:
                        mappings:
                            id:
                                type: integer
                            name:
                                type: text
                                boost: 5
                            firstname:
                                type: text
                                boost: 3
                            dateofbirth:
                                type: date
                            country:
                                type: "nested"
                                 properties:
                                 id: 
                                    type : integer
                                 label: 
                                    type: text 
                        persistence:
                            driver: orm
                            model: AppBundle\Entity\Personn
                            finder: ~
                            provider: ~
                            listener: ~
nephen
  • 1