i just want to pass a list of integer/ list of string to save in my elasticsearch data store from my spring boot application. I am sending the request through postman but it gives following error.
"status": 500,
"error": "Internal Server Error",
"message": "Elasticsearch exception [type=mapper_parsing_exception, reason=object mapping for [abPath] tried to parse field [null] as object, but found a concrete value]"
my model class abPath class variable is configured as follows
@Field( type = FieldType.Integer, store = true)
private List<Integer> abPath;
My Postman request attribute set as follows
"abPath": [1, 2, 3]
if i set "abPath" as null, request is completed without any errors
after that i found a way to save as follows
public class AB{
private Integer abId;
// constructor and getter setter
}
//then i update my model
@Field( type = FieldType.Nested)
private List<AB> abPath;
//then postman request updated as follows
"abPath" : [{"abId" : 1}, {"abId" : 2}]
then request completed without any errors..
I want to know is,
is that the way to save integer list or string list into elasticsearch?
is there any other better approaches?
can i save the list of integers or list of strings without wrapping values into any other objects like i did?