http.asciidoc 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. [[modules-http]]
  2. == HTTP
  3. The http module allows to expose *elasticsearch* APIs
  4. over HTTP.
  5. The http mechanism is completely asynchronous in nature, meaning that
  6. there is no blocking thread waiting for a response. The benefit of using
  7. asynchronous communication for HTTP is solving the
  8. http://en.wikipedia.org/wiki/C10k_problem[C10k problem].
  9. When possible, consider using
  10. http://en.wikipedia.org/wiki/Keepalive#HTTP_Keepalive[HTTP keep alive]
  11. when connecting for better performance and try to get your favorite
  12. client not to do
  13. http://en.wikipedia.org/wiki/Chunked_transfer_encoding[HTTP chunking].
  14. IMPORTANT: HTTP pipelining is not supported and should be disabled in your HTTP client.
  15. [float]
  16. === Settings
  17. The following are the settings that can be configured for HTTP:
  18. [cols="<,<",options="header",]
  19. |=======================================================================
  20. |Setting |Description
  21. |`http.port` |A bind port range. Defaults to `9200-9300`.
  22. |`http.bind_host` |The host address to bind the HTTP service to. Defaults to `http.host` (if set) or `network.bind_host`.
  23. |`http.publish_host` |The host address to publish for HTTP clients to connect to. Defaults to `http.host` (if set) or `network.publish_host`.
  24. |`http.host` |Used to set the `http.bind_host` and the `http.publish_host` Defaults to `http.host` or `network.host`.
  25. |`http.max_content_length` |The max content of an HTTP request. Defaults
  26. to `100mb`
  27. |`http.max_initial_line_length` |The max length of an HTTP URL. Defaults
  28. to `4kb`
  29. |`http.compression` |Support for compression when possible (with
  30. Accept-Encoding). Defaults to `false`.
  31. |`http.compression_level` |Defines the compression level to use.
  32. Defaults to `6`.
  33. |`http.cors.enabled` |Enable or disable cross-origin resource sharing,
  34. i.e. whether a browser on another origin can do requests to
  35. Elasticsearch. Defaults to `false`.
  36. |`http.cors.allow-origin` |Which origins to allow. Defaults to `*`,
  37. i.e. any origin. If you prepend and append a `/` to the value, this will
  38. be treated as a regular expression, allowing you to support HTTP and HTTPs.
  39. for example using `/https?:\/\/localhost(:[0-9]+)?/` would return the
  40. request header appropriately in both cases.
  41. |`http.cors.max-age` |Browsers send a "preflight" OPTIONS-request to
  42. determine CORS settings. `max-age` defines how long the result should
  43. be cached for. Defaults to `1728000` (20 days)
  44. |`http.cors.allow-methods` |Which methods to allow. Defaults to
  45. `OPTIONS, HEAD, GET, POST, PUT, DELETE`.
  46. |`http.cors.allow-headers` |Which headers to allow. Defaults to
  47. `X-Requested-With, Content-Type, Content-Length`.
  48. |`http.cors.allow-credentials` | Whether the `Access-Control-Allow-Credentials`
  49. header should be returned. Note: This header is only returned, when the setting is
  50. set to `true`. Defaults to `false`
  51. |=======================================================================
  52. It also uses the common
  53. <<modules-network,network settings>>.
  54. [float]
  55. === Disable HTTP
  56. The http module can be completely disabled and not started by setting
  57. `http.enabled` to `false`. This make sense when creating non
  58. <<modules-node,data nodes>> which accept HTTP
  59. requests, and communicate with data nodes using the internal
  60. <<modules-transport,transport>>.