Fielddata cache shows nothing

Our goal is to find out how to reduce memory consumption of elasticsearch and for that I checked
our use of fielddata cache.
I understand that fielddata cache is used to store aggregations and sorting results.
In my application we use sorting very much and not so much aggregation queries.
I ran this query:

GET /events/_search
{
    "sort" : 
        { "timestamp" : {"order" : "asc"}}
}  

and this query

GET /events/_search
{
    "sort" : 
        { "id" : {"order" : "asc"}}
        , "size": 1000     
}

and got results.

After that I checked the fielddata cache and got

{
   "_shards": {
      "total": 3,
      "successful": 3,
      "failed": 0
   },
   "_all": {
      "primaries": {
         "fielddata": {
            "memory_size_in_bytes": 0,
            "evictions": 0,
            "fields": {
               "_parent": {
                  "memory_size_in_bytes": 0
               }
            }
         }
      },
      "total": {
         "fielddata": {
            "memory_size_in_bytes": 0,
            "evictions": 0,
            "fields": {
               "_parent": {
                  "memory_size_in_bytes": 0
               }
            }
         }
      }
   },
   "indices": {
      "events": {
         "primaries": {
            "fielddata": {
               "memory_size_in_bytes": 0,
               "evictions": 0,
               "fields": {
                  "_parent": {
                     "memory_size_in_bytes": 0
                  }
               }
            }
         },
         "total": {
            "fielddata": {
               "memory_size_in_bytes": 0,
               "evictions": 0,
               "fields": {
                  "_parent": {
                     "memory_size_in_bytes": 0
                  }
               }
            }
         }
      }
   }
}

So fielddata cache is not used? Why is that?

Thank you

Hi,

What version do you use?

Actually, fieldata is a data structure that basically maps a document's field with its values, so that it's easy to access all field values once you know the document and the field name. This is used internally to compute aggregations (but not to store them) and also to sort search hits.

There's another feature that is used when computing aggs and sorting docs: doc values. It's a more efficient disk based data structure for similar usage. It can be used with most field types but not text. Elasticsearch (in the recent versions) will always prefer to use doc values for things like sorting, and that can explain why fielddata is not used in your example (I support id is of type keyword and timstamp is a date or long)

Thank you for your answer. I am running elasticsearch 5.0.0.
I want to understand which structures in elasticsearch are consuming memory in order to try
and configure them in a way that I could allocate less heap size.
All my caches seems almost empty when I look at the node stats, but still 38% of heap is used.
Can you please help me understand this?

"D1_QIMfUSoiIKAMwWfNTpA": {
         "indices": {
            "docs": {
               "count": 1707940,
               "deleted": 13
            },
            "store": {
               "size_in_bytes": 111575525,
               "throttle_time_in_millis": 0
            },
            "indexing": {
               "index_total": 4007,
               "index_time_in_millis": 665,
               "index_current": 0,
               "index_failed": 0,
               "delete_total": 7,
               "delete_time_in_millis": 7,
               "delete_current": 0,
               "noop_update_total": 1,
               "is_throttled": false,
               "throttle_time_in_millis": 0
            },
             "merges": {
               "current": 0,
               "current_docs": 0,
               "current_size_in_bytes": 0,
               "total": 1,
               "total_time_in_millis": 1440,
               "total_docs": 28359,
               "total_size_in_bytes": 1897215,
               "total_stopped_time_in_millis": 0,
               "total_throttled_time_in_millis": 0,
               "total_auto_throttle_in_bytes": 20971520
            },
            "refresh": {
               "total": 6,
               "total_time_in_millis": 218
            },
            "flush": {
               "total": 28,
               "total_time_in_millis": 1296
            },
            "warmer": {
               "current": 0,
               "total": 29,
               "total_time_in_millis": 51
            },
            "query_cache": {
               "memory_size_in_bytes": 0,
               "total_count": 33,
               "hit_count": 0,
               "miss_count": 33,
               "cache_size": 0,
               "cache_count": 0,
               "evictions": 0
            },
            "fielddata": {
               "memory_size_in_bytes": 0,
               "evictions": 0
            },
            "completion": {
               "size_in_bytes": 0
            },
            "segments": {
               "count": 13,
               "memory_in_bytes": 752545,
               "terms_memory_in_bytes": 510448,
               "stored_fields_memory_in_bytes": 92040,
               "term_vectors_memory_in_bytes": 0,
               "norms_memory_in_bytes": 6656,
               "points_memory_in_bytes": 142205,
               "doc_values_memory_in_bytes": 1196,
               "index_writer_memory_in_bytes": 0,
               "version_map_memory_in_bytes": 0,
               "fixed_bit_set_memory_in_bytes": 0,
               "max_unsafe_auto_id_timestamp": -1,
               "file_sizes": {}
            },
            "translog": {
               "operations": 0,
               "size_in_bytes": 43
            },
            "request_cache": {
               "memory_size_in_bytes": 0,
               "evictions": 0,
               "hit_count": 0,
               "miss_count": 0
            },
            "recovery": {
               "current_as_source": 0,
               "current_as_target": 0,
               "throttle_time_in_millis": 12
            }
         },
         "os": {
            "timestamp": 1487082930237,
            "cpu": {
               "percent": 2,
               "load_average": {
                  "1m": 1.15,
                  "5m": 0.92,
                  "15m": 0.81
               }
            },
            "mem": {
               "total_in_bytes": 53436141568,
               "free_in_bytes": 3483336704,
               "used_in_bytes": 49952804864,
               "free_percent": 7,
               "used_percent": 93
            },
            "swap": {
               "total_in_bytes": 0,
               "free_in_bytes": 0,
               "used_in_bytes": 0
            }
         },
         "process": {
            "timestamp": 1487082930237,
            "open_file_descriptors": 202,
            "max_file_descriptors": 65536,
            "cpu": {
               "percent": 0,
               "total_in_millis": 22880
            },
            "mem": {
               "total_virtual_in_bytes": 3261501440
            }
         },
         "jvm": {
            "timestamp": 1487082930238,
            "uptime_in_millis": 46726,
            "mem": {
               "heap_used_in_bytes": 200369872,
               "heap_used_percent": 38,
               "heap_committed_in_bytes": 519438336,
               "heap_max_in_bytes": 519438336,
               "non_heap_used_in_bytes": 76521080,
               "non_heap_committed_in_bytes": 81330176,
               "pools": {
                  "young": {
                     "used_in_bytes": 99732776,
                     "max_in_bytes": 139591680,
                     "peak_used_in_bytes": 139591680,
                     "peak_max_in_bytes": 139591680
                  },
                  "survivor": {
                     "used_in_bytes": 6763448,
                     "max_in_bytes": 17432576,
                     "peak_used_in_bytes": 17432568,
                     "peak_max_in_bytes": 17432576
                  },
                  "old": {
                     "used_in_bytes": 93873648,
                     "max_in_bytes": 362414080,
                     "peak_used_in_bytes": 93873648,
                     "peak_max_in_bytes": 362414080
                  }
               }
            },
            "buffer_pools": {
               "direct": {
                  "count": 30,
                  "used_in_bytes": 71406353,
                  "total_capacity_in_bytes": 71406352
               },
               "mapped": {
                  "count": 31,
                  "used_in_bytes": 110824445,
                  "total_capacity_in_bytes": 110824445
               }
            }

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