Allow for the usage of the msearch API

Open
#2,934 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
elasticsearch, php, wordpress
Domain
backend, search

Research direction

Read wp-content/plugins/elasticpress/includes/classes/Elasticsearch.php, especially query(), and compare it with the msearch API behavior described in the issue. Check how the ep_skip_query_integration filter currently affects this path. Done means multiple index queries can be sent and results returned through ElasticPress without bypassing its other functions and filters.

Written by the indexing model from the issue text.

Description

enhancement

Is your enhancement related to a problem? Please describe.

I would like to be able to search multiple indexes with one search query, but right now ElasticPress appears to only override one query at a time.

Describe the solution you'd like

Elasticsearch has the msearch, Multi Search, API which allows you to send many separate queries in one request and receive all of the results at once. https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html

Describe alternatives you've considered

I've created my own msearch functionality by copying and modifying the contents of wp-content/plugins/elasticpress/includes/classes/Elasticsearch.php->query(). But I've consequently had to bypass the entire ElasticPress mechanism using the ep_skip_query_integration filter, which precludes the use of the majority of EP, its functions and filters - I'm essentially only using the Feature and Indexable APIs to create and sync custom indexes.

So, it would be better if msearch was integrated into EP, perhaps with a filter in the query() function that can toggle _search/_msearch?

Additional context
This is with regards to the #3 BuddyPress Integration, which requires the creation of many indexes for the various custom BP tables. It is obviously ideal to be able to do a full network-wide search for each search term.

Dominant language
PHP
Stars
1.3k
Forks
325
Avg merge
2d 11h
Merged PRs (30d)
24

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from 10up/ElasticPress

All issues in 10up/ElasticPress

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.