1
0

createindex.asciidoc 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. [[java-rest-high-create-index]]
  2. === Create Index API
  3. [[java-rest-high-create-index-request]]
  4. ==== Create Index Request
  5. A `CreateIndexRequest` requires an `index` argument:
  6. ["source","java",subs="attributes,callouts,macros"]
  7. --------------------------------------------------
  8. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[create-index-request]
  9. --------------------------------------------------
  10. <1> The index to create
  11. ==== Index settings
  12. Each index created can have specific settings associated with it.
  13. ["source","java",subs="attributes,callouts,macros"]
  14. --------------------------------------------------
  15. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[create-index-request-settings]
  16. --------------------------------------------------
  17. <1> Settings for this index
  18. ==== Index mappings
  19. An index may be created with mappings for its document types
  20. ["source","java",subs="attributes,callouts,macros"]
  21. --------------------------------------------------
  22. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[create-index-request-mappings]
  23. --------------------------------------------------
  24. <1> The type to define
  25. <2> The mapping for this type, provided as a JSON string
  26. ==== Index aliases
  27. Aliases can be set at index creation time
  28. ["source","java",subs="attributes,callouts,macros"]
  29. --------------------------------------------------
  30. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[create-index-request-aliases]
  31. --------------------------------------------------
  32. <1> The alias to define
  33. ==== Optional arguments
  34. The following arguments can optionally be provided:
  35. ["source","java",subs="attributes,callouts,macros"]
  36. --------------------------------------------------
  37. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[create-index-request-timeout]
  38. --------------------------------------------------
  39. <1> Timeout to wait for the all the nodes to acknowledge the index creation as a `TimeValue`
  40. <2> Timeout to wait for the all the nodes to acknowledge the index creatiom as a `String`
  41. ["source","java",subs="attributes,callouts,macros"]
  42. --------------------------------------------------
  43. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[create-index-request-masterTimeout]
  44. --------------------------------------------------
  45. <1> Timeout to connect to the master node as a `TimeValue`
  46. <2> Timeout to connect to the master node as a `String`
  47. ["source","java",subs="attributes,callouts,macros"]
  48. --------------------------------------------------
  49. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[create-index-request-waitForActiveShards]
  50. --------------------------------------------------
  51. <1> The number of active shard copies to wait for before proceeding with the operation, as an `int`.
  52. <2> The number of active shard copies to wait for before proceeding with the operation, as an `ActiveShardCount`.
  53. [[java-rest-high-create-index-sync]]
  54. ==== Synchronous Execution
  55. ["source","java",subs="attributes,callouts,macros"]
  56. --------------------------------------------------
  57. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[create-index-execute]
  58. --------------------------------------------------
  59. [[java-rest-high-create-index-async]]
  60. ==== Asynchronous Execution
  61. ["source","java",subs="attributes,callouts,macros"]
  62. --------------------------------------------------
  63. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[create-index-execute-async]
  64. --------------------------------------------------
  65. <1> Called when the execution is successfully completed. The response is
  66. provided as an argument
  67. <2> Called in case of failure. The raised exception is provided as an argument
  68. [[java-rest-high-create-index-response]]
  69. ==== Create Index Response
  70. The returned `CreateIndexResponse` allows to retrieve information about the executed
  71. operation as follows:
  72. ["source","java",subs="attributes,callouts,macros"]
  73. --------------------------------------------------
  74. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[create-index-response]
  75. --------------------------------------------------
  76. <1> Indicates whether all of the nodes have acknowledged the request
  77. <2> Indicates whether the requisite number of shard copies were started for each shard in the index before timing out