Generic Elastic Index Search using Spring Scroll API

I would to like to know how is possible implement a generic search service using Spring Data Scroll API. I will write a simple sample to understand the context of question:

  • I have a index with name F1 with these fiels:
    Id, project_id, sample_id, field_A, field_B, field_C

  • I have other index with name F2, with these fields:
    Id, project_id, sample_id, field_A, field_H, field_M, field_Z

These samples try to show that in my elastic repository (multitenant) will exist diferent indices with diferent names, each of these indices will share some filds in common in this case: id, project_id, sample_id, but the rest of the fiels of the index can be diferent with diferent names and types (multitenant elastic repository)

I need to implement a search service in spring using the scroll api to recover all documents from these indices in a generic way. I will know the mapping of these indices at first: name, type of these fields to be used by the spring service at runtime to create a generic domain to recover all documents of any index using name of each one.

Leave a Comment