Advertisement
renatoSouza

Untitled

Mar 6th, 2019
445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 3.64 KB | None | 0 0
  1. ============CHAMADA QUERY=========
  2. GET /accounts/_doc/_search
  3. {
  4.   "query" : {
  5.     "match" : {
  6.       "job_description" : "analista"
  7.     }
  8.   },
  9.   "aggregations" : {
  10.     "age" : {
  11.       "range" : {
  12.         "field" : "age",
  13.         "ranges" : [
  14.           {
  15.             "key" : "0-9",
  16.             "from" : 0,
  17.             "to" : 9
  18.           },
  19.           {
  20.             "key" : "18-25",
  21.             "from" : 18,
  22.             "to" : 25
  23.           },
  24.           {
  25.             "key" : "26-30",
  26.             "from" : 26,
  27.             "to" : 30
  28.           },
  29.           {
  30.             "key" : "31-35",
  31.             "from" : 31,
  32.             "to" : 35
  33.           },
  34.           {
  35.             "key" : "36-40",
  36.             "from" : 36,
  37.             "to" : 40
  38.           }
  39.           ]
  40.       }
  41.     }
  42.   }
  43. }
  44.  
  45. ============RETORNO QUERY=========
  46. {
  47.   "took" : 6,
  48.   "timed_out" : false,
  49.   "_shards" : {
  50.     "total" : 5,
  51.     "successful" : 5,
  52.     "skipped" : 0,
  53.     "failed" : 0
  54.   },
  55.   "hits" : {
  56.     "total" : 6,
  57.     "max_score" : 0.80259144,
  58.     "hits" : [
  59.       {
  60.         "_index" : "accounts",
  61.         "_type" : "_doc",
  62.         "_id" : "7",
  63.         "_score" : 0.80259144,
  64.         "_source" : {
  65.           "name" : "Renato",
  66.           "lastname" : "Santos de Souza",
  67.           "job_description" : "Analista",
  68.           "age" : 32
  69.         }
  70.       },
  71.       {
  72.         "_index" : "accounts",
  73.         "_type" : "_doc",
  74.         "_id" : "HrRCSWkBGSMNuB0loAro",
  75.         "_score" : 0.21110918,
  76.         "_source" : {
  77.           "name" : "Renato",
  78.           "lastname" : "Souza",
  79.           "job_description" : "Analista de Software JR2"
  80.         }
  81.       },
  82.       {
  83.         "_index" : "accounts",
  84.         "_type" : "_doc",
  85.         "_id" : "6",
  86.         "_score" : 0.19263543,
  87.         "_source" : {
  88.           "name" : "Renato",
  89.           "lastname" : "Santos de Souza",
  90.           "job_description" : "Analista",
  91.           "age" : 5
  92.         }
  93.       },
  94.       {
  95.         "_index" : "accounts",
  96.         "_type" : "_doc",
  97.         "_id" : "3",
  98.         "_score" : 0.16044298,
  99.         "_source" : {
  100.           "name" : "Lucas",
  101.           "lastname" : "Santos de Souza",
  102.           "job_description" : "Analista de testes e gerente internod e projetos",
  103.           "age" : 35
  104.         }
  105.       },
  106.       {
  107.         "_index" : "accounts",
  108.         "_type" : "_doc",
  109.         "_id" : "2",
  110.         "_score" : 0.12114187,
  111.         "_source" : {
  112.           "name" : "Priscila",
  113.           "lastname" : "Santos de Souza",
  114.           "job_description" : "Analista de Produtos e  negócios",
  115.           "age" : 20
  116.         }
  117.       },
  118.       {
  119.         "_index" : "accounts",
  120.         "_type" : "_doc",
  121.         "_id" : "4",
  122.         "_score" : 0.11085624,
  123.         "_source" : {
  124.           "name" : "Renato",
  125.           "lastname" : "Santos de Souza",
  126.           "job_description" : "Analista UX e Gerente de Infraestrutura",
  127.           "age" : 2
  128.         }
  129.       }
  130.     ]
  131.   },
  132.   "aggregations" : {
  133.     "age" : {
  134.       "buckets" : [
  135.         {
  136.           "key" : "0-9",
  137.           "from" : 0.0,
  138.           "to" : 9.0,
  139.           "doc_count" : 2
  140.         },
  141.         {
  142.           "key" : "18-25",
  143.           "from" : 18.0,
  144.           "to" : 25.0,
  145.           "doc_count" : 1
  146.         },
  147.         {
  148.           "key" : "26-30",
  149.           "from" : 26.0,
  150.           "to" : 30.0,
  151.           "doc_count" : 0
  152.         },
  153.         {
  154.           "key" : "31-35",
  155.           "from" : 31.0,
  156.           "to" : 35.0,
  157.           "doc_count" : 1
  158.         },
  159.         {
  160.           "key" : "36-40",
  161.           "from" : 36.0,
  162.           "to" : 40.0,
  163.           "doc_count" : 0
  164.         }
  165.       ]
  166.     }
  167.   }
  168. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement