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

[BUG] Default config file causes initial indexing to fail #109

Open
kudlohlavec opened this issue Apr 1, 2020 · 0 comments
Open

[BUG] Default config file causes initial indexing to fail #109

kudlohlavec opened this issue Apr 1, 2020 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@kudlohlavec
Copy link

Describe the bug
After publishing of config file and running import command, there is an error that is probably caused by deprecated usage of type attribute. As it can be seen at official elasticsearch docs.

To Reproduce
Steps to reproduce the behavior:

  1. Publish config with php artisan vendor:publish --tag config
  2. Run indexing command php artisan scout:import
  3. Get error: Root mapping definition has unsupported parameters

Expected behavior
Successful indexing

Additional context
I also tried to remove type attribute from default mapping, what seems to solve unsupported parameters error, however it yielded another error: java.util.ArrayList cannot be cast to java.util.Map. According to google, that error often comes up when some empty field is being passed into elasticsearch. So it looks like there needs some other alteration in the config structure to be done.

What is more, when I have removed overall mappings part, indexing has been finished successfully without any problems. I am using v7.6.1 of elasticsearch-php.

Original config that resulted in unsupported parameters error:

return [
    'host' => env('ELASTICSEARCH_HOST'),
    'indices' => [
        'mappings' => [
            'default' => [
                'properties' => [
                    'id' => [
                        'type' => 'keyword',
                    ],
                ],
            ],
        ],
        'settings' => [
            'default' => [
                'number_of_shards' => 1,
                'number_of_replicas' => 0,
            ],
        ],
    ],
];

Edited config that resulted in java.util.ArrayList error:

return [
    'host' => env('ELASTICSEARCH_HOST'),
    'indices' => [
        'mappings' => [
            'default' => [
                'properties' => [
                    'id' 
                ],
            ],
        ],
        'settings' => [
            'default' => [
                'number_of_shards' => 1,
                'number_of_replicas' => 0,
            ],
        ],
    ],
];

Config that resulted in successful indexing:

return [
    'host' => env('ELASTICSEARCH_HOST'),
    'indices' => [
        'settings' => [
            'default' => [
                'number_of_shards' => 1,
                'number_of_replicas' => 0,
            ],
        ],
    ],
];
@kudlohlavec kudlohlavec added the bug Something isn't working label Apr 1, 2020
@matchish matchish added the help wanted Extra attention is needed label Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants