elasticsearch.php 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <?php
  2. return [
  3. /**
  4. * You can specify one of several different connections when building an
  5. * Elasticsearch client.
  6. *
  7. * Here you may specify which of the connections below you wish to use
  8. * as your default connection when building an client. Of course you may
  9. * use create several clients at once, each with different configurations.
  10. */
  11. 'defaultConnection' => 'default',
  12. /**
  13. * These are the connection parameters used when building a client.
  14. */
  15. 'connections' => [
  16. 'default' => [
  17. /**
  18. * Hosts
  19. *
  20. * This is an array of hosts that the client will connect to. It can be a
  21. * single host, or an array if you are running a cluster of Elasticsearch
  22. * instances.
  23. *
  24. * This is the only configuration value that is mandatory.
  25. *
  26. * Presently using "extended" host configuration method
  27. *
  28. * @see https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/_configuration.html#_extended_host_configuration
  29. *
  30. * There is also the shorter "inline" configuration method available
  31. *
  32. * @see https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/_configuration.html#_inline_host_configuration
  33. */
  34. 'hosts' => [
  35. [
  36. 'host' => env('ELASTICSEARCH_HOST', 'localhost'),
  37. 'port' => env('ELASTICSEARCH_PORT', 9200),
  38. 'scheme' => env('ELASTICSEARCH_SCHEME', null),
  39. 'user' => env('ELASTICSEARCH_USER', null),
  40. 'pass' => env('ELASTICSEARCH_PASS', null),
  41. // If you are connecting to an Elasticsearch instance on AWS, you will need these values as well
  42. 'aws' => env('AWS_ELASTICSEARCH_ENABLED', false),
  43. 'aws_region' => env('AWS_REGION', ''),
  44. 'aws_key' => env('AWS_ACCESS_KEY_ID', ''),
  45. 'aws_secret' => env('AWS_SECRET_ACCESS_KEY', '')
  46. ],
  47. ],
  48. /**
  49. * SSL
  50. *
  51. * If your Elasticsearch instance uses an out-dated or self-signed SSL
  52. * certificate, you will need to pass in the certificate bundle. This can
  53. * either be the path to the certificate file (for self-signed certs), or a
  54. * package like https://github.com/Kdyby/CurlCaBundle. See the documentation
  55. * below for all the details.
  56. *
  57. * If you are using SSL instances, and the certificates are up-to-date and
  58. * signed by a public certificate authority, then you can leave this null and
  59. * just use "https" in the host path(s) above and you should be fine.
  60. *
  61. * @see https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/_security.html#_ssl_encryption_2
  62. */
  63. 'sslVerification' => null,
  64. /**
  65. * Logging
  66. *
  67. * Logging is handled by passing in an instance of Monolog\Logger (which
  68. * coincidentally is what Laravel's default logger is).
  69. *
  70. * If logging is enabled, you either need to set the path and log level
  71. * (some defaults are given for you below), or you can use a custom logger by
  72. * setting 'logObject' to an instance of Psr\Log\LoggerInterface. In fact,
  73. * if you just want to use the default Laravel logger, then set 'logObject'
  74. * to \Log::getMonolog().
  75. *
  76. * Note: 'logObject' takes precedent over 'logPath'/'logLevel', so set
  77. * 'logObject' null if you just want file-based logging to a custom path.
  78. *
  79. * @see https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/_configuration.html#enabling_logger
  80. */
  81. 'logging' => false,
  82. // If you have an existing instance of Monolog you can use it here.
  83. // 'logObject' => \Log::getMonolog(),
  84. 'logPath' => storage_path('logs/elasticsearch.log'),
  85. 'logLevel' => Monolog\Logger::INFO,
  86. /**
  87. * Retries
  88. *
  89. * By default, the client will retry n times, where n = number of nodes in
  90. * your cluster. If you would like to disable retries, or change the number,
  91. * you can do so here.
  92. *
  93. * @see https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/_configuration.html#_set_retries
  94. */
  95. 'retries' => null,
  96. /**
  97. * The remainder of the configuration options can almost always be left
  98. * as-is unless you have specific reasons to change them. Refer to the
  99. * appropriate sections in the Elasticsearch documentation for what each option
  100. * does and what values it expects.
  101. */
  102. /**
  103. * Sniff On Start
  104. *
  105. * @see https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/_configuration.html
  106. */
  107. 'sniffOnStart' => false,
  108. /**
  109. * HTTP Handler
  110. *
  111. * @see https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/_configuration.html#_configure_the_http_handler
  112. * @see http://ringphp.readthedocs.org/en/latest/client_handlers.html
  113. */
  114. 'httpHandler' => null,
  115. /**
  116. * Connection Pool
  117. *
  118. * @see https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/_configuration.html#_setting_the_connection_pool
  119. * @see https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/_connection_pool.html
  120. */
  121. 'connectionPool' => null,
  122. /**
  123. * Connection Selector
  124. *
  125. * @see https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/_configuration.html#_setting_the_connection_selector
  126. * @see https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/_selectors.html
  127. */
  128. 'connectionSelector' => null,
  129. /**
  130. * Serializer
  131. *
  132. * @see https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/_configuration.html#_setting_the_serializer
  133. * @see https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/_serializers.html
  134. */
  135. 'serializer' => null,
  136. /**
  137. * Connection Factory
  138. *
  139. * @see https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/_configuration.html#_setting_a_custom_connectionfactory
  140. */
  141. 'connectionFactory' => null,
  142. /**
  143. * Endpoint
  144. *
  145. * @see https://www.elastic.co/guide/en/elasticsearch/client/php-api/6.0/_configuration.html#_set_the_endpoint_closure
  146. */
  147. 'endpoint' => null,
  148. /**
  149. * Register additional namespaces
  150. *
  151. * An array of additional namespaces to register.
  152. *
  153. * @example 'namespaces' => [XPack::Security(), XPack::Watcher()]
  154. * @see https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/ElasticsearchPHP_Endpoints.html#Elasticsearch_ClientBuilderregisterNamespace_registerNamespace
  155. */
  156. 'namespaces' => []
  157. ],
  158. ],
  159. ];