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

Unable to have multiple types #1512

Closed
DONSA opened this issue Apr 23, 2019 · 2 comments
Closed

Unable to have multiple types #1512

DONSA opened this issue Apr 23, 2019 · 2 comments

Comments

@DONSA
Copy link

DONSA commented Apr 23, 2019

I'm getting this error when I try to populate:

[Elastica\Exception\ResponseException]
Rejecting mapping update to [app] as the final mapping would have more than 1 type: [item, shipment]

This is the configuration I have:

$container->loadFromExtension('fos_elastica', [
    'default_manager' => 'orm',
    'clients' => [
        'default' => [
            'host' => '127.0.0.1',
            'port' => 9200,
            'logger' => '%kernel.debug%'
        ]
    ],
    'indexes' => [
        'app' => [
            'types' => [
                'shipment' => [
                    'persistence' => [
                        'model' => Shipment::class,
                    ],
                    'serializer' => [
                        'groups' => ['elastica'],
                        'serialize_null' => false
                    ]
                ],
                'item' => [
                    'persistence' => [
                        'model' => Item::class,
                    ],
                    'serializer' => [
                        'groups' => ['elastica'],
                        'serialize_null' => false
                    ]
                ]
            ]
        ]
    ],
]);
@oachoor
Copy link

oachoor commented Apr 30, 2019

@DONSA, you cannot have several types within a single index anymore, at least since 6.x.
Workaround would be that you define a type per index:

'indexes' => [
    'app_shipment' => [
        'types' => [
            '_doc' => [
                'persistence' => [
                    'model' => Shipment::class,
                ],
                'serializer' => [
                    'groups' => ['elastica'],
                    'serialize_null' => false
                ]
            ]
        ]
    ],
    'app_item' => [
        'types' => [
            '_doc' => [
                'persistence' => [
                    'model' => Item::class,
                ],
                'serializer' => [
                    'groups' => ['elastica'],
                    'serialize_null' => false
                ]
            ]
        ]
    ]
]

@DONSA
Copy link
Author

DONSA commented Apr 30, 2019

Ok, thanks. I think this should be referenced in the documentation.

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

2 participants