vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Count.php line 36

Open in your IDE?
  1. <?php
  2. /**
  3.  * Elasticsearch PHP client
  4.  *
  5.  * @link      https://github.com/elastic/elasticsearch-php/
  6.  * @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
  7.  * @license   http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
  8.  * @license   https://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License, Version 2.1 
  9.  * 
  10.  * Licensed to Elasticsearch B.V under one or more agreements.
  11.  * Elasticsearch B.V licenses this file to you under the Apache 2.0 License or
  12.  * the GNU Lesser General Public License, Version 2.1, at your option.
  13.  * See the LICENSE file in the project root for more information.
  14.  */
  15. declare(strict_types 1);
  16. namespace Elasticsearch\Endpoints;
  17. use Elasticsearch\Endpoints\AbstractEndpoint;
  18. /**
  19.  * Class Count
  20.  * Elasticsearch API name count
  21.  *
  22.  * NOTE: this file is autogenerated using util/GenerateEndpoints.php
  23.  * and Elasticsearch 7.17.0 (bee86328705acaa9a6daede7140defd4d9ec56bd)
  24.  */
  25. class Count extends AbstractEndpoint
  26. {
  27.     public function getURI(): string
  28.     {
  29.         $index $this->index ?? null;
  30.         $type $this->type ?? null;
  31.         if (isset($type)) {
  32.             @trigger_error('Specifying types in urls has been deprecated'E_USER_DEPRECATED);
  33.         }
  34.         if (isset($index) && isset($type)) {
  35.             return "/$index/$type/_count";
  36.         }
  37.         if (isset($index)) {
  38.             return "/$index/_count";
  39.         }
  40.         return "/_count";
  41.     }
  42.     public function getParamWhitelist(): array
  43.     {
  44.         return [
  45.             'ignore_unavailable',
  46.             'ignore_throttled',
  47.             'allow_no_indices',
  48.             'expand_wildcards',
  49.             'min_score',
  50.             'preference',
  51.             'routing',
  52.             'q',
  53.             'analyzer',
  54.             'analyze_wildcard',
  55.             'default_operator',
  56.             'df',
  57.             'lenient',
  58.             'terminate_after'
  59.         ];
  60.     }
  61.     public function getMethod(): string
  62.     {
  63.         return isset($this->body) ? 'POST' 'GET';
  64.     }
  65.     public function setBody($body): Count
  66.     {
  67.         if (isset($body) !== true) {
  68.             return $this;
  69.         }
  70.         $this->body $body;
  71.         return $this;
  72.     }
  73. }