Olivier
12/16/2025, 4:29 PMcurl 'http://localhost:8108/multi_search?page=1&per_page=10' -X POST \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '
{
"union": true,
"searches": [
{
"collection": "products",
"q": "wireless headphones",
"query_by": "name,description"
},
{
"collection": "articles",
"q": "wireless headphones",
"query_by": "title,content"
}
]
}'
Passing page/per_page in the URL looks a bit strange in that payload IMHO. Is there a way to pass them in the JSON payload?Fanis Tharropoulos
12/16/2025, 4:46 PMpage and per_page in the JSON payload when using multisearch with the union option. These need to be included in the URL query string instead.
When a request comes in, the system first processes the URL query parameters (like page, per_page, etc.), and then it processes the JSON body separately. For union searches, only certain settings (like union and remove_duplicates) are pulled from the JSON body. Pagination settings, however, are ignored in the body and are expected to be part of the URL query.
So, when Typesense runs the union search, it uses the parameters from the URL, not the JSON body. The pagination options are designed to be global for the entire search (like one page value for the whole union), rather than being applied to each individual search in the union. This keeps things simpler and avoids any confusion with different pagination values for each search.Olivier
12/16/2025, 4:51 PM{
"union":true,
"page": 1,
"per_page": 2,
"searches": [...]
}
But I also understand your point of view.Fanis Tharropoulos
12/16/2025, 4:54 PM