http.asciidoc 3.1 KB

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