I saw Spring Boot's mapping with the document annotation. Using the @Document annotation to define the index obligates me to specific amount of fields and specific fields names. In my application users define their own fields, so @Document is not a good match for my needs.
How can I achieve dynamic fields for a specific index with spring data?
example:
A user generates some data:
Map<String, String> data = new HashMap<>();
//new fields
data.put("oranges", "tasty");
data.put("apples", "baaa");
data.put("avocado", "ok");
// existing fields
data.put("totalFruits", 20);
and calls a method, lets say:
void indexData(String indexName, Map<String, String> data)
Output will be:
- the addition of the 3 fields to the index
- a new document in index indexName containing all fields