R
R
ruboss2015-10-01 00:35:30
PHP
ruboss, 2015-10-01 00:35:30

How to make a Multy get fetch from Elasticsearch php?

Hello!
I am learning Elasticsearch on php client.
How can one find multiple documents in ES, by id, equivalent to "WHERE id IN (1,2,3,4,9)" in SQL?
For mono geta I do this

$params = [
    'index' => 'my_index',
    'type' => 'my_type',
    'id' => 'my_id'
  ];

  $response = $client->get($params);

how to pull multiple records?
Tried like this but it doesn't work
$params = ;

  $response = $client->mget($params);

so
$params = [
    'index' => 'my_index',
    'type' => 'my_type',
    'id' => array('my_id','my_id2')
  ];

  $response = $client->mget($params);

The PHP API only has https://www.elastic.co/guide/en/elasticsearch/clie...
This is what it looks like, only in a CURL request https://www.elastic.co/guide/en/elasticsearch /refe...
Who worked with ES, help please!)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Makarov, 2015-10-01
@ruboss

https://github.com/elastic/elasticsearch-php/blob/...

$params = [
    'index' => 'my_index',
    'type' => 'my_type',
    'body' => [
        'ids' => [1, 2, ...]
    ]
];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question