http.asciidoc 2.7 KB

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