If you are experiencing issues with setting up Enterprise Search, more information for debugging can be found by looking at:
Data sync currently only copies your production data to a non-production environment. It currently doesn’t create, affect, or modify any Elasticsearch indexes in that non-production environment.
If you are working in a non-production environment, and initiate a data sync from production to develop, for instance, you will need to create or version the Elasticsearch indexes for the develop environment following the data sync. For more information, see related issues under VIP CLI.
Enterprise Search health and statistics
You can use the following commands to determine the general health and understand how much content has been indexed.
# validate the index against the DB $ wp vip-search health validate-counts Validating post count ✅ no inconsistencies found when counting entity: post, type: post, index_version: 1 - (DB: 1, ES: 1, Diff: 0) ✅ no inconsistencies found when counting entity: post, type: page, index_version: 1 - (DB: 1, ES: 1, Diff: 0) Validating user count ✅ no inconsistencies found when counting entity: user, type: N/A, index_version: 1 - (DB: 1, ES: 1, Diff: 0) # validate the contents $ wp vip-search health validate-contents Validating posts 1 - 4...✓ Success: No inconsistencies found! # other health commands: $ wp vip-search health usage: wp vip-search health validate-contents [--inspect] [--start_post_id=<int>] [--last_post_id=<int>] [--batch_size=<int>] [--max_diff_size=<int>] [--format=<string>] [--do_not_heal] [--silent] [--force_parallel_execution] or: wp vip-search health validate-counts or: wp vip-search health validate-posts-count [--version=<int>] [--network-wide] or: wp vip-search health validate-users-count [--version=<int>] [--network-wide] See 'wp help vip-search health <command>' for more information on a specific command. # statistics $ wp vip-search stats ====== Stats for: vip-200508-post-1 ====== Documents: 2 Index Size: 29.79 KB Index Size (including replicas): 29.79 KB ====== End Stats ====== ====== Stats for: vip-200508-user ====== Documents: 1 Index Size: 50.82 KB Index Size (including replicas): 50.82 KB ====== End Stats ======
Some errors may stem from Enterprise Search not being enabled, or an Elasticsearch index not being set up yet for an environment. These errors (or portions of them) may be searchable in the mu-plugins repository.
During health commands:
Warning: Error while validating count: failure querying ES. #vip-search may appear (multiple times) because the index is not set up. This is likely to happen in non-production environments and may happen after a data sync.
wp vip-search status – it will return a JSON object; while the output is complex, a 0 index size may suggest an index for posts needs to be created.
wp vip-search index --setup to create an initial index (exercise caution in production; if you’re certain an index does exist – contact support!). Then once that is complete, run the health check again.
Debug Bar / Query Monitor
The debug bar panel will tell you about any Elasticsearch queries run on the current page.
- Perform a search
- Open Debug Bar or Query Monitor
- An ElasticPress panel will be present if VIP Search is active
- If the current page has invoked Elasticsearch (ES) queries, they will be displayed in the ElasticPress panel
New Relic will expose PHP errors, remote requests and activity during transactions.
- Open New Relic to the External Services tab
- Under “Servers” at the left, look for an entry such as “es-ha-bur.vipv2.net” for example. The string “bur” is an abbreviation for a data center, and other values such as “dfw“, “dca“, “ams“, etc. may appear instead.
- The graph here is a representation of the frequency of use of the search endpoint for the containers actively monitored by New Relic. The actual stats can be derived by multiplying by the total number of containers and dividing by the containers monitored in New Relic. For example, if 2 of a total 12 containers are reporting 10k/hour, this is 10,000 / 2 x 12.
- You can also see which request endpoints are most frequently using ES.
- Transaction summaries will have the ES host listed in the breakdown.
- Traces that include ES requests will show the remote request nested under
ElasticPress\Elasticsearch::remote_requestwhich may itself be nested under
- Review New Relic’s error logs for search-related warnings and notices from the plugin that need to be addressed.
- Throughout the Enterprise Search code, you’ll find
_doing_it_wrong()calls are used to throw configuration warnings. If you see these warnings in logs, they should provide the information needed to resolve the issue. If the cause is still not clear, look for the strings in the source code for context, or open a support ticket.