I have following data
:
"orders":{
"placed_orders_count":2,
"0":{
"order_id":"000000001",
"order_date":"2019-03-27 14:25:03"
},
"1":{
"order_id":"000000002",
"order_date":"2019-03-27 14:25:03"
}
}
I want to insert all this data into Solr. I have tried:
String customerFeedJson = new Gson().toJson(customerFeedsolr.getOrders());
String solrUrl = solrServerUrl.concat(customerFeedPrefix).concat(Constants.HYPHEN).concat(String.valueOf(siteID))
.concat(Constants.SOLR_URL_QUERIES);
HttpEntity<String> requestEntity = new HttpEntity<String>(Arrays.asList(customerFeedJson).toString());
restTemplate.exchange(solrUrl, HttpMethod.POST, requestEntity, String.class);
But on Solr, I am only able to index "placed_orders_count":2
.
I have indexed orders field
as:
public class CustomerFeedSolr {
@Indexed("orders_*")
@Field(child = true)
private Map<String, ?> orders;
//Getters and Setters
}
Expectations:
"placed_orders_count":[2.0],
"0":[
"order_id":"000000001",
"order_date":"2019-03-27 14:25:03"
],
"1":[
"order_id":"000000002",
"order_date":"2019-03-27 14:25:03"
]
Actual
"placed_orders_count":[2.0]