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

Update mappings #2315

Merged
merged 1 commit into from
Aug 19, 2021
Merged

Conversation

pschoffer
Copy link
Contributor

@pschoffer pschoffer commented Aug 18, 2021

Description of the Change

When applying mappings we get following warnings on ES - 7.8.0

Warning: 299 Elasticsearch-7.8.0-757314695644ea9a1dc2fecd26d1a43856725e65 "The [edgeNGram] token filter name is deprecated and will be removed in a future version. Please change the filter name to [edge_ngram] instead." in /wp/wp-content/mu-plugins/search/includes/classes/class-search.php on line 765 [$ /usr/local/bin/wp vip-search index --setup] [wp-content/mu-plugins/search/includes/classes/class-search.php:765 trigger_error(), wp-includes/class-wp-hook.php:292 Automattic\VIP\Search\Search->filter__ep_do_intercept_request(), wp-includes/plugin.php:212 WP_Hook->apply_filters(), wp-content/mu-plugins/search/elasticpress/includes/classes/Elasticsearch.php:1155 apply_filters('ep_do_intercept_request'), wp-content/mu-plugins/search/elasticpress/includes/classes/Elasticsearch.php:785 ElasticPress\Elasticsearch->remote_request(), wp-content/mu-plugins/search/elasticpress/includes/classes/Indexable/Post/Post.php:247 ElasticPress\Elasticsearch->put_mapping(), wp-content/mu-plugins/search/elasticpress/includes/classes/Command.php:263 ElasticPress\Indexable\Post\Post->put_mapping(), wp-content/mu-plugins/search/elasticpress/includes/classes/Command.php:619 ElasticPress\Command->put_mapping_helper(), ElasticPress\Command->index(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100 call_user_func(), WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:491 call_user_func(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:399 WP_CLI\Dispatcher\Subcommand->invoke(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/class-wp-cli.php:1391 WP_CLI\Runner->run_command(), wp-content/mu-plugins/search/includes/classes/commands/class-corecommand.php:198 WP_CLI::run_command(), Automattic\VIP\Search\Commands\CoreCommand->index(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100 call_user_func(), WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:491 call_user_func(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:399 WP_CLI\Dispatcher\Subcommand->invoke(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:422 WP_CLI\Runner->run_command(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:1194 WP_CLI\Runner->run_command_and_exit(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:23 WP_CLI\Runner->start(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/bootstrap.php:77 WP_CLI\Bootstrap\LaunchRunner->process(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/wp-cli.php:27 WP_CLI\bootstrap(), phar:///usr/local/binphp/boot-phar.php:11 include('phar:///usr/local/binvendor/wp-cli/wp-cli/php/wp-cli.php'), /usr/local/bin/wp:4 include('phar:///usr/local/binphp/boot-phar.php')]
Warning: 299 Elasticsearch-7.8.0-757314695644ea9a1dc2fecd26d1a43856725e65 "dynamic template [template_meta_types] has invalid content [{\"path_match\":\"meta.*\",\"mapping\":{\"path\":\"full\",\"properties\":{\"date\":{\"format\":\"yyyy-MM-dd\",\"type\":\"date\"},\"datetime\":{\"format\":\"yyyy-MM-dd HH:mm:ss\",\"type\":\"date\"},\"boolean\":{\"type\":\"boolean\"},\"double\":{\"type\":\"double\"},\"raw\":{\"ignore_above\":10922,\"type\":\"keyword\"},\"time\":{\"format\":\"HH:mm:ss\",\"type\":\"date\"},\"value\":{\"type\":\"text\",\"fields\":{\"raw\":{\"ignore_above\":10922,\"type\":\"keyword\"},\"sortable\":{\"normalizer\":\"lowerasciinormalizer\",\"ignore_above\":10922,\"type\":\"keyword\"}}},\"long\":{\"type\":\"long\"}},\"type\":\"object\"}}], caused by [Unused mapping attributes [{path=full}]]" in /wp/wp-content/mu-plugins/search/includes/classes/class-search.php on line 765 [$ /usr/local/bin/wp vip-search index --setup] [wp-content/mu-plugins/search/includes/classes/class-search.php:765 trigger_error(), wp-includes/class-wp-hook.php:292 Automattic\VIP\Search\Search->filter__ep_do_intercept_request(), wp-includes/plugin.php:212 WP_Hook->apply_filters(), wp-content/mu-plugins/search/elasticpress/includes/classes/Elasticsearch.php:1155 apply_filters('ep_do_intercept_request'), wp-content/mu-plugins/search/elasticpress/includes/classes/Elasticsearch.php:785 ElasticPress\Elasticsearch->remote_request(), wp-content/mu-plugins/search/elasticpress/includes/classes/Indexable/Post/Post.php:247 ElasticPress\Elasticsearch->put_mapping(), wp-content/mu-plugins/search/elasticpress/includes/classes/Command.php:263 ElasticPress\Indexable\Post\Post->put_mapping(), wp-content/mu-plugins/search/elasticpress/includes/classes/Command.php:619 ElasticPress\Command->put_mapping_helper(), ElasticPress\Command->index(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100 call_user_func(), WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:491 call_user_func(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:399 WP_CLI\Dispatcher\Subcommand->invoke(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/class-wp-cli.php:1391 WP_CLI\Runner->run_command(), wp-content/mu-plugins/search/includes/classes/commands/class-corecommand.php:198 WP_CLI::run_command(), Automattic\VIP\Search\Commands\CoreCommand->index(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100 call_user_func(), WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:491 call_user_func(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:399 WP_CLI\Dispatcher\Subcommand->invoke(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:422 WP_CLI\Runner->run_command(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:1194 WP_CLI\Runner->run_command_and_exit(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:23 WP_CLI\Runner->start(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/bootstrap.php:77 WP_CLI\Bootstrap\LaunchRunner->process(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/wp-cli.php:27 WP_CLI\bootstrap(), phar:///usr/local/binphp/boot-phar.php:11 include('phar:///usr/local/binvendor/wp-cli/wp-cli/php/wp-cli.php'), /usr/local/bin/wp:4 include('phar:///usr/local/binphp/boot-phar.php')]
Warning: 299 Elasticsearch-7.8.0-757314695644ea9a1dc2fecd26d1a43856725e65 "dynamic template [template_terms] has invalid content [{\"path_match\":\"terms.*\",\"mapping\":{\"path\":\"full\",\"properties\":{\"parent\":{\"type\":\"long\"},\"name\":{\"type\":\"text\",\"fields\":{\"raw\":{\"type\":\"keyword\"},\"sortable\":{\"normalizer\":\"lowerasciinormalizer\",\"type\":\"keyword\"}}},\"term_taxonomy_id\":{\"type\":\"long\"},\"term_order\":{\"type\":\"long\"},\"term_id\":{\"type\":\"long\"},\"facet\":{\"type\":\"keyword\"},\"slug\":{\"type\":\"keyword\"}},\"type\":\"object\"}}], caused by [Unused mapping attributes [{path=full}]]" in /wp/wp-content/mu-plugins/search/includes/classes/class-search.php on line 765 [$ /usr/local/bin/wp vip-search index --setup] [wp-content/mu-plugins/search/includes/classes/class-search.php:765 trigger_error(), wp-includes/class-wp-hook.php:292 Automattic\VIP\Search\Search->filter__ep_do_intercept_request(), wp-includes/plugin.php:212 WP_Hook->apply_filters(), wp-content/mu-plugins/search/elasticpress/includes/classes/Elasticsearch.php:1155 apply_filters('ep_do_intercept_request'), wp-content/mu-plugins/search/elasticpress/includes/classes/Elasticsearch.php:785 ElasticPress\Elasticsearch->remote_request(), wp-content/mu-plugins/search/elasticpress/includes/classes/Indexable/Post/Post.php:247 ElasticPress\Elasticsearch->put_mapping(), wp-content/mu-plugins/search/elasticpress/includes/classes/Command.php:263 ElasticPress\Indexable\Post\Post->put_mapping(), wp-content/mu-plugins/search/elasticpress/includes/classes/Command.php:619 ElasticPress\Command->put_mapping_helper(), ElasticPress\Command->index(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100 call_user_func(), WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:491 call_user_func(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:399 WP_CLI\Dispatcher\Subcommand->invoke(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/class-wp-cli.php:1391 WP_CLI\Runner->run_command(), wp-content/mu-plugins/search/includes/classes/commands/class-corecommand.php:198 WP_CLI::run_command(), Automattic\VIP\Search\Commands\CoreCommand->index(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100 call_user_func(), WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:491 call_user_func(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:399 WP_CLI\Dispatcher\Subcommand->invoke(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:422 WP_CLI\Runner->run_command(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:1194 WP_CLI\Runner->run_command_and_exit(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:23 WP_CLI\Runner->start(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/bootstrap.php:77 WP_CLI\Bootstrap\LaunchRunner->process(), phar:///usr/local/binvendor/wp-cli/wp-cli/php/wp-cli.php:27 WP_CLI\bootstrap(), phar:///usr/local/binphp/boot-phar.php:11 include('phar:///usr/local/binvendor/wp-cli/wp-cli/php/wp-cli.php'), /usr/local/bin/wp:4 include('phar:///usr/local/binphp/boot-phar.php')]

These changes are addressing the issues by:

  • renaming edgeNGram (deprecated) -> edge_ngram (which is supported at least in all 7.x versions)
  • dropping unknown attribute path under mapping in dynamic_templates

Alternate Designs

Benefits

Possible Drawbacks

Verification Process

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Applicable Issues

Changelog Entry

@pschoffer pschoffer changed the title update mappings [In Progress] update mappings Aug 18, 2021
@@ -131,7 +131,6 @@
'path_match' => 'meta.*',
'mapping' => [
'type' => 'object',
'path' => 'full',
Copy link
Contributor Author

@pschoffer pschoffer Aug 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path attribute under mapping is unexpected. I didn't find any ElasticSearch documentation describing what this attribute is for or that it in fact exists. Which is why it feels safe to remove.

But I am happy to hear about its purpose.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tracked it as far as 7eea2bc (7 years ago, pre-5.2 mapping)

@felipeelia felipeelia added this to the 3.6.2 milestone Aug 18, 2021
@felipeelia felipeelia self-assigned this Aug 18, 2021
@pschoffer pschoffer changed the title [In Progress] update mappings Update mappings Aug 19, 2021
@felipeelia felipeelia merged commit 91ec9d9 into 10up:develop Aug 19, 2021
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

Successfully merging this pull request may close these issues.

3 participants