Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
RCY
Contributor
Contributor

Get Data from json object

0695b00000KARwlAAH.pngI 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

0695b00000KARwRAAX.png

Labels (3)
1 Reply
Anonymous
Not applicable

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