Closed murilolivorato closed 12 months ago
@murilolivorato unfortunately, the usage of the msearch API is not so obvious. You need to use a structure like as follows:
$params = [
'index' => 'index-test-one',
'body' => [
[],
[ 'query' => [ 'match_all' => new stdClass ] ],
[ 'index' => 'index-test-two' ],
[ 'query' => [ 'match_all' => new stdClass ] ]
]
];
$response = $elasticSearch->msearch($params);
As you can see the empty value []
is required as first element in the body
array. This is because the HTTP request is application/x-ndjson
, basically an array of JSON.
Let me know if this works for you, thanks!
Hello , I am using
like this doc - https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html
well it is working in kibana . but when I try to do it , in php . does not work .
this is my test code -
it gives his error -
I Tryed like this -
and it gives me always empty results.
this works -
USING SEARCH -
RESULT
BUT using MSEARCH , does not work , always bringing empty result -
USING MSEARCH -
RESULT