Group indexes multi searching?

Hi, I have 5 indexes with identical properties. How do I get 10 best results from each index when multi searching?

$search = [
    'index' => 'table_*',
    'body' => [
        'size' => '10',
        'query' => [
            'match' => [
                'name' => 'test search test'
            ]
        ],
    ],
];

I expect such a result:

[table_1] => [1,2,3,4,5,6,7,8,9,10]
[table_2] => [1,2,3,4,5,6,7,8,9,10]
[table_3] => [1,2,3,4,5,6,7,8,9,10]
[table_4] => [1,2,3,4,5,6,7,8,9,10]
[table_5] => [1,2,3,4,5,6,7,8,9,10]

Have a look at the multisearch API.

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html

I probably see bad or do not quite understand? (

That's the right API to use IMO to solve the use case you described.

i see this example, it is convenient that it is not required to specify a specific list of indexes, but I cannot understand how to group from this example

$search = [
    'index' => 'table_*',
    'body' => [
        'size' => '10',
        'query' => [
            'match' => [
                'name' => 'test search test'
            ]
        ],
    ],
];

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.