Elasticsearch-PHP

  1. $esclient = Elasticsearch\ClientBuilder::create()
  2. ->setHosts(["localhost:9200"])
  3. ->build();
  4. $params = [
  5. 'index' => 'social-*',
  6. 'body' => [
  7. 'query' => [
  8. 'match' => [ 'message' => 'myProduct' ]
  9. ],
  10. 'aggs' => [
  11. 'top_10_states' => [
  12. 'terms' => [
  13. 'field' => 'state',
  14. 'size' => 10,
  15. ]
  16. ]
  17. ]
  18. ]
  19. ];
  20. $response = $esclient->search($params);

https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/index.html

猜你喜欢

转载自blog.csdn.net/qq_25600055/article/details/80093599