vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Search.php line 31

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 Search
  20.  * Elasticsearch API name search
  21.  *
  22.  * NOTE: this file is autogenerated using util/GenerateEndpoints.php
  23.  * and Elasticsearch 7.17.0 (bee86328705acaa9a6daede7140defd4d9ec56bd)
  24.  */
  25. class Search 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/_search";
  36.         }
  37.         if (isset($index)) {
  38.             return "/$index/_search";
  39.         }
  40.         return "/_search";
  41.     }
  42.     public function getParamWhitelist(): array
  43.     {
  44.         return [
  45.             'analyzer',
  46.             'analyze_wildcard',
  47.             'ccs_minimize_roundtrips',
  48.             'default_operator',
  49.             'df',
  50.             'explain',
  51.             'stored_fields',
  52.             'docvalue_fields',
  53.             'from',
  54.             'ignore_unavailable',
  55.             'ignore_throttled',
  56.             'allow_no_indices',
  57.             'expand_wildcards',
  58.             'lenient',
  59.             'preference',
  60.             'q',
  61.             'routing',
  62.             'scroll',
  63.             'search_type',
  64.             'size',
  65.             'sort',
  66.             '_source',
  67.             '_source_excludes',
  68.             '_source_includes',
  69.             'terminate_after',
  70.             'stats',
  71.             'suggest_field',
  72.             'suggest_mode',
  73.             'suggest_size',
  74.             'suggest_text',
  75.             'timeout',
  76.             'track_scores',
  77.             'track_total_hits',
  78.             'allow_partial_search_results',
  79.             'typed_keys',
  80.             'version',
  81.             'seq_no_primary_term',
  82.             'request_cache',
  83.             'batched_reduce_size',
  84.             'max_concurrent_shard_requests',
  85.             'pre_filter_shard_size',
  86.             'rest_total_hits_as_int',
  87.             'min_compatible_shard_node'
  88.         ];
  89.     }
  90.     public function getMethod(): string
  91.     {
  92.         return isset($this->body) ? 'POST' 'GET';
  93.     }
  94.     public function setBody($body): Search
  95.     {
  96.         if (isset($body) !== true) {
  97.             return $this;
  98.         }
  99.         $this->body $body;
  100.         return $this;
  101.     }
  102. }