Elastic search data availability issue

Hello everyone, I developed service (based on our use case) on top of elasticsearch node client. For the testing of service, I wrote some functional tests, in those tests, I perform the following steps:

  1. Create an index
  2. Insert a document in the index
  3. Pull the inserted document back from the index

These tests run in ubuntu docker container environment details are given below:

LSB Version: core-9.20170808ubuntu1-noarch:printing-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic

Installed elasticsearch's inside the docker container:

"version" : {
"number" : "6.5.4",
"build_flavor" : "default",
"build_type" : "deb",
"build_hash" : "d2ef93d",
"build_date" : "2018-12-17T21:17:40.758843Z",
"build_snapshot" : false,
"lucene_version" : "7.5.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},

ISSUE

I faced an issue in step 3 when I pull data from an index because elastic search takes almost 1 second time to make the data available.

While the same tests run on my local machine without any issue, my current system is version is:

LSB Version: core-9.20170808ubuntu1-noarch:printing-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic

Question
Is this issue caused by the docker container environment?

In a test context, you need to call the refresh API to make your documents visible for search.

Thank you for quick response, I will try this approach.

@dadoonet that seems to be a test specific rationale, but why is this happening in the docker version and NOT the baremetal version?

It is happening the same way.
I think you are just "unlucky" with the bare metal instance. :wink:

A refresh is happening every second more or less.

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