LINUX.ORG.RU

перенести индексы в elasticsearch

 


0

1

нужно перенести индексы на другой сервер. версии elasticsearch 2.3.5 => 7.9.2 делаю через elasticdump

elasticdump --input=http://localhost:9200/nut_uk --output=nut_uk_mapping.json   --type=mapping
elasticdump --input=http://localhost:9200/nut_uk --output=nut_uk_data.json   --type=data

затем импорт

elasticdump   --output=http://localhost:9200/nut_uk   --input=nut_uk_mapping.json   --type=mapping

тут лезет ошибка

Wed, 14 Feb 2024 19:43:46 GMT | starting dump
Wed, 14 Feb 2024 19:43:46 GMT | got 1 objects from source file (offset: 0)
Wed, 14 Feb 2024 19:43:46 GMT | Error Emitted => {"root_cause":[{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters:  [search : {properties={category_id={type=integer}, model_name={index=not_analyzed, type=keyword}, sub_category_id={type=integer}, language={index=not_analyzed, type=keyword}, sub_category_slug={index=not_analyzed, type=keyword}, label={analyzer=fivegrams, type=string}, model_id={type=integer}, published={type=integer}, category_slug={index=not_analyzed, type=keyword}, content={analyzer=fivegrams, type=string}, slug={index=not_analyzed, type=keyword}, builder_content={analyzer=fivegrams, type=string}}}]"}],"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters:  [search : {properties={category_id={type=integer}, model_name={index=not_analyzed, type=keyword}, sub_category_id={type=integer}, language={index=not_analyzed, type=keyword}, sub_category_slug={index=not_analyzed, type=keyword}, label={analyzer=fivegrams, type=string}, model_id={type=integer}, published={type=integer}, category_slug={index=not_analyzed, type=keyword}, content={analyzer=fivegrams, type=string}, slug={index=not_analyzed, type=keyword}, builder_content={analyzer=fivegrams, type=string}}}]"}
Wed, 14 Feb 2024 19:43:46 GMT | Error Emitted => {"root_cause":[{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters:  [search : {properties={category_id={type=integer}, model_name={index=not_analyzed, type=keyword}, sub_category_id={type=integer}, language={index=not_analyzed, type=keyword}, sub_category_slug={index=not_analyzed, type=keyword}, label={analyzer=fivegrams, type=string}, model_id={type=integer}, published={type=integer}, category_slug={index=not_analyzed, type=keyword}, content={analyzer=fivegrams, type=string}, slug={index=not_analyzed, type=keyword}, builder_content={analyzer=fivegrams, type=string}}}]"}],"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters:  [search : {properties={category_id={type=integer}, model_name={index=not_analyzed, type=keyword}, sub_category_id={type=integer}, language={index=not_analyzed, type=keyword}, sub_category_slug={index=not_analyzed, type=keyword}, label={analyzer=fivegrams, type=string}, model_id={type=integer}, published={type=integer}, category_slug={index=not_analyzed, type=keyword}, content={analyzer=fivegrams, type=string}, slug={index=not_analyzed, type=keyword}, builder_content={analyzer=fivegrams, type=string}}}]"}
Wed, 14 Feb 2024 19:43:46 GMT | Total Writes: 0
Wed, 14 Feb 2024 19:43:46 GMT | dump ended with error (get phase) => [object Object]

как выполнить перенос?

Ответ на: комментарий от HE_KOT

индексы перенести получилось, отредактировал файл mapping, обновил библиотеку,также исправил поисковый запрос

было

return [
            'filtered' => [
                'query' => [
                    'multi_match' => [
                        'query' => $queryString ?? '',
                        'type' => 'best_fields',
                        'minimum_should_match' => '90%',
                        'fields' => [
                            'label^3',
                            'content^2',
                            'builder_content^2',
                        ]
                    ],
                ],
                'filter' => [
                    'bool' => [
                        'must' => [
                            ['term' => ['language' => \Yii::$app->language]],
                            ['term' => ['published' => 1]],
                        ],
                    ],
                ],
            ]
        ];

стало

 return [
            'bool' => [
                'must' => [
                    'multi_match' => [
                        'query' => $queryString ?? '',
                        'type' => 'best_fields',
                        'minimum_should_match' => '90%',
                        'fields' => [
                            'label^3',
                            'content^2',
                            'builder_content^2',
                        ]
                    ],
                ],
                'filter' => [
                    'bool' => [
                        'must' => [
                            ['term' => ['language' => \Yii::$app->language]],
                            ['term' => ['published' => 1]],
                        ],
                    ],
                ],
            ]
        ];

в итоге ничего не находит по запросу. это проблема в запросе или в некорректном переносе индексов? что проверить?

limpopo44
() автор топика