segments.asciidoc 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. [[indices-segments]]
  2. == Indices Segments
  3. Provide low level segments information that a Lucene index (shard level)
  4. is built with. Allows to be used to provide more information on the
  5. state of a shard and an index, possibly optimization information, data
  6. "wasted" on deletes, and so on.
  7. Endpoints include segments for a specific index, several indices, or
  8. all:
  9. [source,js]
  10. --------------------------------------------------
  11. curl -XGET 'http://localhost:9200/test/_segments'
  12. curl -XGET 'http://localhost:9200/test1,test2/_segments'
  13. curl -XGET 'http://localhost:9200/_segments'
  14. --------------------------------------------------
  15. Response:
  16. [source,js]
  17. --------------------------------------------------
  18. {
  19. ...
  20. "_3": {
  21. "generation": 3,
  22. "num_docs": 1121,
  23. "deleted_docs": 53,
  24. "size_in_bytes": 228288,
  25. "memory_in_bytes": 3211,
  26. "committed": true,
  27. "search": true,
  28. "version": "4.6",
  29. "compound": true
  30. }
  31. ...
  32. }
  33. --------------------------------------------------
  34. _0:: The key of the JSON document is the name of the segment. This name
  35. is used to generate file names: all files starting with this
  36. segment name in the directory of the shard belong to this segment.
  37. generation:: A generation number that is basically incremented when needing to
  38. write a new segment. The segment name is derived from this
  39. generation number.
  40. num_docs:: The number of non-deleted documents that are stored in this segment.
  41. deleted_docs:: The number of deleted documents that are stored in this segment.
  42. It is perfectly fine if this number is greater than 0, space is
  43. going to be reclaimed when this segment gets merged.
  44. size_in_bytes:: The amount of disk space that this segment uses, in bytes.
  45. memory_in_bytes:: Segments need to store some data into memory in order to be
  46. searchable efficiently. This number returns the number of bytes
  47. that are used for that purpose. A value of -1 indicates that
  48. Elasticsearch was not able to compute this number.
  49. committed:: Whether the segment has been sync'ed on disk. Segments that are
  50. committed would survive a hard reboot. No need to worry in case
  51. of false, the data from uncommitted segments is also stored in
  52. the transaction log so that Elasticsearch is able to replay
  53. changes on the next start.
  54. search:: Whether the segment is searchable. A value of false would most
  55. likely mean that the segment has been written to disk but no
  56. refresh occurred since then to make it searchable.
  57. version:: The version of Lucene that has been used to write this segment.
  58. compound:: Whether the segment is stored in a compound file. When true, this
  59. means that Lucene merged all files from the segment in a single
  60. one in order to save file descriptors.