Perform multiple searches in one single HTTP request
brunoocasali opened this issue · comments
Also, if you are a maintainer, feel free to add any clarification and instruction about this issue.
Sorry if this is already partially/completely implemented, feel free to let me know about the state of this issue in the repo.
Related to meilisearch/integration-guides#251
Related to:
Create a new client method called multiSearch
/multi_search
, which will request POST /multi-search
with a body payload containing a structure similar to this:
{
"queries": [
{ "indexUid": "movie", "q": "wonder", "limit": 10 },
{ "indexUid": "books", "q": "king", "page": 2 }
]
}
Each object is a simple search object sent in the POST /indexes/:indexUid/search
request.
Pay attention to the response, which will follow the order of the requests object and will look like this (note the new indexUid
key in the response):
{
"results": [
{
"indexUid": "movie",
"hits": [ { "title": "wonderwoman" } ],
// other search results fields: processingTimeMs, limit, ...
},
{
"indexUid": "books",
"hits": [ { "title": "king kong theory" } ],
// other search results fields: processingTimeMs, limit, ...
},
]
}
TODO:
- Add the new
multiSearch
method - Add tests
- Add code-sample
multi_search_1
in the.code-samples.meilisearch.yaml
file. Translate the following curl example by using the just introduced java method: https://github.com/meilisearch/documentation/blob/e4fdc3d485c22e31a045b8a71bacf18b6a7d50e0/.code-samples.meilisearch.yaml#L988C10-L988C10
Mistake, wrong PR, reopening