Converting Categorized CSV Data To Multilevel Format In EsProc
Converting categorized CSV to multilevel data: import CSV, group by metric, convert to JSON using esProc script.
Problem description & analysis Below is data in CSV file csv.csv: metric,value,date temp_a,622.0,1477895624866 temp_a,-3.0,1477916224866 temp_a,365.0,1477917224866 temp_b,861.0,1477895624866 temp_b,767.0,1477917224866 We are trying to convert the categorized CSV data into multilevel data, as shown below: [ { "metric":"temp_a", "datapoints":[ [622, 1477895624866], [-3, 1477916224866], [365, 1477917224866] ] }, { "metric":"temp_b", "datapoints":[ [861, 1477895624866], [767, 1477917224866] ] } ] Solution Write the following script p1.d...