18.2. Search Function¶
This function will trigger ElasticSearch search function, if you add a parameter as array, you will get just those fields.
For example:
1<?php
2
3$sort = $elastic->sort()
4 ->index('people')
5 ->field('age')
6 ->order('desc') // you can change to "asc"
7 ->search(['hits', 'took']); // spesific parameters
8
9// You will get hits and took fields
10
11return $sort;