es 相關操做筆記

  1. sort limit
$esCondition = array(
                        'index' => 'incdr',
                        'type' => 'win_incdr',
                        'body' => array(
                            'query' => array(
                                'bool' => array(
                                    'must' => array(
                                        array('match' => array('caller' => $data['telB'])),
                                    ),
                                ),
                            ),
                            'sort' => array(
                                array("start_time" => array('order' => 'desc')),
                            ),
                            'size' => 1,
                        ),
                    );

                    $hosts = $this->container->getParameter('elasticsearch_hosts');
                    $client = new Esclient(array('hosts' => $hosts));
                    $esResult = $client->search($esCondition);
相關文章
相關標籤/搜索