What is the difference on _cat/indices and /_stats on index storage

I was using these two different get calls to collect the index usage information:

  1. My rest call on _stats: GET /index1/_stats, and

    I was looking at the value in indices.index1.primaries.merges.total_size_in_bytes;

  2. My rest call on _cat: GET /_cat/indices/index1?v and

    I was looking at the value in pri.store.size

Are these two values supposed to be the same? If not(at least that is the case on my end and they differs a lot), what is the difference between the logical meanings on these two calls?

Hi senmansei, :wink:

In call GET /my_index/_stats you get more detail of what is going on inside your index, such as: Indexing time, cached query, segments, merge. This type of information we do not have with the call GET _cat/indices/my_index.

Both have the same information, but one is much more detailed than the other. Use the _cat / indices / my_index GET when you want quick information about the status of your index, use the _my_index / stats GET when you need more specific index information such as: the total merge in bytes.

Another note is that the "pri.store.size" (GET _cat/indice/my_index) column represents only the used space of the primary shards. The "store.size" column represents the size of the primary shards + replicas.

Ah! In the GET my_index / stats call you see the output only in bytes.
did you get it ?

Thank you Fram for your time and reply. Your answer did help a lot.

However, it still doesn't resolve my confusion that the value of "pri.store.size" (GET _cat/indice/my_index) is not equal to the value of "indices.index1.primaries.merges.total_size_in_bytes" (GET /index1/_stats) on my side. I guess according to your answer, these two values should still be the same as they mesures store size both on primary shards.

FYI, I've done bytes to mb conversion before the value comparison.

@senmansei ;D

Do you merge indices? In this metric "indices.index1.primaries.merges.total_size_in_bytes" we will have the total bytes that were "mergeados". If you want to find the same value that is obtained in the GET _cat / index / my_index call you should parse the flag "indeices.index1.store.size_in_bytes". Data merge is performed to save disk space, ie if you have multiple small segments of a Lucene index, the merge will join together all those segments of a larger segment, which helps us a lot in search performance .

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.