elasticsearch icon indicating copy to clipboard operation
elasticsearch copied to clipboard

multiple analyzers not working

Open ruipimentelfigueiredo opened this issue 7 years ago • 1 comments

When i try to update my index with:

php artisan es:indices:update

I get the following error

{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"analyzer [autocomplete_search] not found for field [firstname]"}],"type":"mapper_parsing_exception","reason":"analyzer [autocomplete_search] not found for field [firstname]"},"status":400}

here is my index configuration:

   'project-live => [

        'aliases' => [
            'project'
        ],

        'settings' => [
            'analysis' => [
                'filter' => [
                    'autocomplete_filter' => [
                        'type' => 'edge_ngram',
                        'min_gram' => 1,
                        'max_gram' => 20
                    ],
                    'portuguese_stop' => [
                        'type' => 'stop',
                        'stopwords' => '_portuguese_'
                    ],
                ],
                'analyzer' => [
                    'autocomplete' => [
                        'type' => 'custom',
                        'tokenizer' => 'standard',
                        'filter' => [
                            'autocomplete_filter',
                            'asciifolding',
                            'lowercase',
                            'portuguese_stop',
                        ],
                    ],
                    'autocomplete_search' => [
                        'type' => 'custom',
                        'tokenizer' => 'standard',
                        'filter' => [
                            'asciifolding',
                            'lowercase',
                            'portuguese_stop',
                        ],
                    ],
                ],
            ],
            'number_of_shards' => 1,
            'number_of_replicas' => 1
        ],

        'mappings' => [
            'doctors_index' => [
                'properties' => [
                    'firstname' => [
                        'type' => 'string',
                        'analyzer' => 'autocomplete',
                        'search_analyzer' => 'autocomplete_search'
                    ],
                    'lastname' => [
                        'type' => 'string',
                        'analyzer' => 'autocomplete',
                        'search_analyzer' => 'autocomplete_search'
                    ]
                ]
            ],
            'clinics_index' => [
                'properties' => [
                    'name' => [
                        'type' => 'string',
                        'analyzer' => 'autocomplete',
                        'search_analyzer' => 'autocomplete_search'
                    ]
                ]
            ],
            'examCategories_index' => [
                'properties' => [
                    'name' => [
                        'type' => 'string',
                        'analyzer' => 'autocomplete',
                        'search_analyzer' => 'autocomplete_search'
                    ]
                ]
            ],
            'specialties_index' => [
                'properties' => [
                    'name' => [
                        'type' => 'string',
                        'analyzer' => 'autocomplete',
                        'search_analyzer' => 'autocomplete_search'
                    ]
                ]
            ],
        ]
    ],

ruipimentelfigueiredo avatar Dec 04 '17 21:12 ruipimentelfigueiredo

i'm having the same problem. how can i configure 2 analysers?

albertocsm avatar Dec 07 '17 14:12 albertocsm