Ledger Nano X - The secure hardware wallet
SHARE
TWEET

search

tuyenvv May 18th, 2020 1,290 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: levis
  5.  * Date: 5/18/20
  6.  * Time: 11:52 PM
  7.  */
  8. include_once 'vendor/autoload.php';
  9.  
  10. require 'vendor/autoload.php';
  11.  
  12. use Elasticsearch\ClientBuilder;
  13.  
  14.  
  15. $esHost = [
  16.     'elasticsearch:9200'
  17. ];
  18. $client = ClientBuilder::create()->setHosts($esHost)->build();
  19.  
  20. $query =[];
  21.  
  22.  
  23.  
  24. $indexName = 'mkp';
  25.  
  26. $query[] = ['index' => $indexName];
  27. $query[] = json_decode('{
  28.  "query": {
  29.    "match": {
  30.      "retailerId": 423677
  31.    }
  32.  },
  33.  "aggs": {
  34.    "categoryIdCount": {
  35.      "terms": {
  36.        "field": "categoryId",
  37.        "size": 10
  38.      }
  39.    }
  40.  }
  41.  
  42. }', true);
  43. $query[] = ['index' => $indexName];
  44. $query[] = json_decode('{
  45.  "query": {
  46.    "match": {
  47.      "retailerId": 423677
  48.    }
  49.  },
  50.  "aggs": {
  51.    "nested_wrap": {
  52.      "nested": {
  53.        "path": "attributes"
  54.      },
  55.      "aggs": {
  56.        "attributeName": {
  57.          "terms": {
  58.            "field": "attributes.attributeName.keyword"
  59.          },
  60.          "aggs": {
  61.            "attributeValue": {
  62.              "terms": {
  63.                "field": "attributes.attributeValue.keyword"
  64.              }
  65.            }
  66.          }
  67.        }
  68.      }
  69.    }
  70.  }
  71. }', true);
  72.  
  73.  
  74. $params = [
  75.     'index' => $indexName,
  76.     'body'  => $query
  77. ];
  78.  
  79. $results = $client->msearch($params);
  80.  
  81. var_dump($results['responses'][1]['aggregations']);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top