Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the following data :
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 20,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "emp_recordnew",
"_type" : "_doc",
"_id" : "TbfJc3wBR6wy7KzvOHFf",
"_score" : 1.0,
"_source" : {
"emp_grade" : "A",
"emp_salry" : 54000,
"emp_name" : "Ranjan Kumar",
"emp_dept" : "IT",
"emp_ID" : 1
}
},
{
"_index" : "emp_recordnew",
"_type" : "_doc",
"_id" : "TrfJc3wBR6wy7KzvOHHn",
"_score" : 1.0,
"_source" : {
"emp_grade" : "A",
"emp_salry" : 45000,
"emp_name" : "Sanjay",
"emp_dept" : "Sales",
"emp_ID" : 2
}
},
{
"_index" : "emp_recordnew",
"_type" : "_doc",
"_id" : "T7fJc3wBR6wy7KzvOXGO",
"_score" : 1.0,
"_source" : {
"emp_grade" : "A",
"emp_salry" : 35000,
"emp_name" : "Arman",
"emp_dept" : "Finance",
"emp_ID" : 3
}
},
{
"_index" : "emp_recordnew",
"_type" : "_doc",
"_id" : "ULfJc3wBR6wy7KzvOnGY",
"_score" : 1.0,
"_source" : {
"emp_grade" : "A",
"emp_salry" : 65000,
"emp_name" : "Praveen",
"emp_dept" : "IT",
"emp_ID" : 4
}
},
{
"_index" : "emp_recordnew",
"_type" : "_doc",
"_id" : "UbfJc3wBR6wy7KzvO3Ex",
"_score" : 1.0,
"_source" : {
"emp_grade" : "A",
"emp_salry" : 34000,
"emp_name" : "Jack",
"emp_dept" : "HR",
"emp_ID" : 5
}
}
]
}
}
i am using tExtractjson field to get the data . I need the hits.total.value and hits[*] at the same time.
I am able to get the hits[* ] value but how do i get the hits.total.value
Hi
Read by Xpath, and set the loop jsonpath query to "/root/hits/hits/_index", you should be able to extract the data you want.
Regards
Shong