17. Query

You can use query function for creating, updating, searching etc.

The index aliases API allows aliasing an index with a name, with all APIs automatically converting the alias name to the actual index name.

Display the aliases list

1<?php
2
3$query = $elastic->query()
4		 ->cat()
5		 ->aliases();
6
7return $query;

Searching with query function:

 1<?php
 2
 3$elastic = new ElasticSearch();
 4
 5$result = $elastic->query([
 6    'index' => 'my-index',
 7    'body' => [
 8        'query' => [
 9            'match' => [
10                'name' => [
11                    'query' => 'Şêro',
12                    'fuzziness' => 1
13                ]
14            ]
15        ]
16    ]
17])->search();
18
19return $result;