Fetch the document record in the same Order


I am trying to fetch a single document "store1" using search API preparesearch method. Below is the document data. I am getting the response into a HashMap<String,Map<String,String>>. However the problem her is the order in which the search result is populated into hashmap. It is populated in random order. i would like to get the result into hashmap in the same order as in the document i.e. (f1,f2,f3,f4,f5,f6). Is there a way to achieve this? Please help.

"_index": "store",
"_type": "store_type",
"_id": "store1",
"_score": 1,
"_source": {
"head": {
"f1": {
"val": "123",
"size": "1"
"f2": {
"value": "854",
"size": "40"
"f3": {
"value": "4545",
"size": "13"
"f4": {
"value": "4545",
"size": "58"
"f5": {
"value": "3565",
"size": "5"
"f6": {
"value": "8542",
"size": "8"

Can some one help me here to solve this.

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