Memory usage in index

Hello,
I am new to ELasticSearch..I created an index and populated with around 500thousand documents.
How can I check what % of my documents are in RAM and how much is stored in disk?
Thanks
Rajeev

Welcome!

Everything is stored on disk.

1 Like

Thank you :blush:

Hey,
Is there any way I can store in RAM to speed up response time?

Files on disk are cached in the operating system page cache, so having lots of RAM available will speed up queries this way. Elastic also uses off-heap memory for some data in additional to the allocated heap.

1 Like

What is the current response time you have?

@dadoonet It is around 150 to 200 ms for simple queries. Even if I run same query why the response time varies every time?

Will every document in index is cached?
When queried , will the results fetched from disk(secondary memory) or page cache?

Could you share your query and the response?

Curl call:
curl -X GET "localhost:9200/test/_search?q=JamesTown&pretty"

Response:

    {
      "took" : 169,
      "timed_out" : false,
      "_shards" : {
        "total" : 5,
        "successful" : 5,
        "skipped" : 0,
        "failed" : 0
      },
      "hits" : {
        "total" : 2,
        "max_score" : 7.391895,
        "hits" : [
          {
            "_index" : "test",
            "_type" : "_doc",
            "_id" : "airport_5745",
            "_score" : 7.391895,
            "_source" : {
              "airportname" : "Jamestown Regional Airport",
              "city" : "Jamestown",
              "country" : "United States",
              "faa" : "JMS",
              "geo" : {
                "alt" : 1498.0,
                "lat" : 46.9297,
                "lon" : -98.6782
              },
              "icao" : "KJMS",
              "id" : 5745,
              "type" : "airport",
              "tz" : "America/Chicago"
            }
          },
          {
            "_index" : "test",
            "_type" : "_doc",
            "_id" : "airport_7059",
            "_score" : 7.391895,
            "_source" : {
              "airportname" : "Chautauqua County-Jamestown",
              "city" : "Jamestown",
              "country" : "United States",
              "faa" : "JHW",
              "geo" : {
                "alt" : 525.0,
                "lat" : 42.153333,
                "lon" : -79.258056
              },
              "icao" : "KJHW",
              "id" : 7059,
              "type" : "airport",
              "tz" : "America/New_York"
            }
          }
        ]
      }
    }

FYI my use case is FullTextSearch. User may search on any field.

If you have only 500k documents, I'd use only one shard. That could help.

I will try it.
Thanks

Can we get to know how much % of docs are in page cache if the RAM is less?

Hey, I tried with only one shard, It is taking almost same time sometimes more.

What kind of hardware do you have?

Using Virtual Machine with ~32 GB RAM

What kind of drives do you have?

Normal HDD, not SSD

That might explain then.
Is it still slow after some runs? It should be cached by the OS at some point.

Yes, After some runs it's better. But for some new queries it is again taking long time.
Thanks for your support.