2017-06-07 6 views
0

のJoltはESを変換するために主に建設されたように、これは非常に簡単あってはならない、MongoDBのresponses.But私はのJolt - 変更elasticsearch応答の形式

をそれを把握することができません、私は唯一の選択ES応答やプリントを解析したいですフィールド。たとえば、私は

{ 
"time" : 63, 
"totalhits":100, 
"0";{ response1.field1,response1.field2}, 
"1";{ response2.field1,response2.field2}, 
"2";{ response3.field1,response3.field2}, 
} 


    { 
    "took" : 63, 
    "timed_out" : false, 
    "_shards" : { 
    "total" : 5, 
    "successful" : 5, 
    "failed" : 0 
    }, 
    "hits" : { 
    "total" : 1000, 
    "max_score" : null, 
    "hits" : [ { 
     "_index" : "bank", 
     "_type" : "account", 
     "_id" : "0", 
     "sort": [0], 
     "_score" : null, 
     "_source" : {"account_number":0,"balance":16623,"firstname":"Bradshaw","lastname":"Mckenzie","age":29,"gender":"F","address":"244 Columbus Place","employer":"Euron","email":"[email protected]","city":"Hobucken","state":"CO"} 
    }, { 
     "_index" : "bank", 
     "_type" : "account", 
     "_id" : "1", 
     "sort": [1], 
     "_score" : null, 
     "_source" : {"account_number":1,"balance":39225,"firstname":"Amber","lastname":"Duke","age":32,"gender":"M","address":"880 Holmes Lane","employer":"Pyrami","email":"[email protected]","city":"Brogan","state":"IL"} 
    }, ... 
    ] 
    } 
    } 

への応答に私がこれまでに得たspecファイルを変換したい

[ 
    { 
    "operation": "shift", 
    "spec": { 
     "hits": { 
     "*": { 
      "*": "&" 
     } 
     } 
    } 
} 
] 

答えて

1

はそれを考え出しています。

[ 
    { 
    "operation": "shift", 
    "spec": { 
     "took": "took", 
     "hits": { 
     "total": "total_hits", 
     "hits": { 
      "*": { 
      "_source": { 
       "country": "Response[&2].country", 
       "city": "Response[&2].city", 
       "year": "Response[&2].year" 
      } 
      } 
     } 
     } 
    } 
    } 
] 
関連する問題