1. $_config = array(
    2. 'host' =>'192.168.1.60', // host
    3. 'port' => 39200,
    4. );
    5. $client = new Elastica\Client($_config);
    6. //$client = new Elastica\Client();
    7. $elastica_query = new Elastica\Query();
    8. $elastica_search = new Elastica\Search($client);
    9. $elastica_search->setQuery($elastica_query);
    10. try {
    11. $b = $elastica_search->search();
    12. } catch (Exception $e) {
    13. var_dump($e->getMessage());
    14. }
    15. $res = ($b->getResults());
    16. foreach ($res as $key => $rs) {
    17. var_dump($rs->getParam('_source'));
    18. //var_dump($rs) ;
    19. }
    20. echo 'all the end';