ElasticSearch 5.0 PHP msearch

There's an msearch endpoint under the root client object:

$client->msearch([
  'body'  => [
    [
      'index' => 'indexA', 
      'type' => 'typeA'],
    [
      'query' => [
          'match_all' => (object)[],
      ],
    ],
    [
      'index' => 'indexB',
      'type' => 'typeB'
    ],
    [
      'size'  => 0,
      'query' => [
          'match_all' => (object)[],
      ],
      'aggs'  => [
          'max_sequence' => ['max' => ['field' => 'sequence']],
      ],
    ],
  ],
]);
5 Likes