Can I create an Elastic Search index manually against an existing mongodb collection?

Hi.. I am new to ES, and have some very specific scenario I would like to achieve.
I am an SDET testing a web app (Blazor / Mongo). For one of my tests I need to seed the db with 5000 records... before they implemented Elastic Search in the project, I would just seed the db by hitting it using MongodbClient from my code, but now I need to seed it using an endpoint they provided, where I have to create each record one by one... and it takes forever...
So, I had an idea which I am not sure is possible.

  1. I seed the 5000 records using the endpoint
  2. I visit the index endpoint (localhost:9200/index) and copy the json for that index
  3. Now, next time I need to run the tests, I will seed the 5000 records using MongodbClient and then create the index manually (PUT index and the json I got from the index in step 2)

I tried it, the index gets created, but I can't see the data in the UI... (already using the ES index)
Is there a way to achieve this?

Thanks

Are you sending a bulk request with the data to Elasticsearch? If so, is it correctly formatted?

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