Skip to content

Instantly share code, notes, and snippets.

@zubairov
Created January 2, 2018 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zubairov/5f2f958a5edd51ebe4b2d88aab05ad82 to your computer and use it in GitHub Desktop.
Save zubairov/5f2f958a5edd51ebe4b2d88aab05ad82 to your computer and use it in GitHub Desktop.
curl -X POST https://apixpc.magicsoftware.com/v2/flows \
-u renat+magicsoftware@elastic.io:4fc886b7-fef3-4c1e-a3c1-2f679e278583 \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' -d $'
{
"data": {
"attributes": {
"name": "Copy of Performance Test",
"cron": null,
"default_mapper_type": "jsonata",
"type": "ordinary",
"graph": {
"nodes": [
{
"command": "magic/csv:read@latest",
"fields": {
"url": "https://storage.googleapis.com/eio-sample/trips_100k.csv",
"reader": {
"header": "trip_id,duration_sec,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_number,zip_code,subscriber_type",
"separator": ",",
"startRow": "0",
"columns": [
{
"title": "trip_id",
"property": "trip_id"
},
{
"title": "duration_sec",
"property": "duration_sec"
},
{
"title": "start_date",
"property": "start_date"
},
{
"title": "start_station_name",
"property": "start_station_name"
},
{
"title": "start_station_id",
"property": "start_station_id"
},
{
"title": "end_date",
"property": "end_date"
},
{
"title": "end_station_name",
"property": "end_station_name"
},
{
"title": "end_station_id",
"property": "end_station_id"
},
{
"title": "bike_number",
"property": "bike_number"
},
{
"title": "zip_code",
"property": "zip_code"
},
{
"title": "subscriber_type",
"property": "subscriber_type"
}
]
}
},
"id": "step_1",
"selected_data_samples": [
"5a4b58ccd6768500193ccb37"
],
"out_data_samples": [
"5a4b58ccd6768500193ccb32",
"5a4b58ccd6768500193ccb33",
"5a4b58ccd6768500193ccb34",
"5a4b58ccd6768500193ccb35",
"5a4b58ccd6768500193ccb36",
"5a4b58cc82a5a700198bfd5a",
"5a4b58cc82a5a700198bfd5b",
"5a4b58cc82a5a700198bfd5c",
"5a4b58ccd6768500193ccb37",
"5a4b58ccd6768500193ccb38",
"5a4b58ccd6768500193ccb39",
"5a4b58ccd6768500193ccb3a",
"5a4b58ccd6768500193ccb3b",
"5a4b58cc82a5a700198bfd5d",
"5a4b58ccd6768500193ccb3c"
]
},
{
"command": "elasticio/code:execute@latest",
"fields": {
"code": "// Please note only Node.js code is supported here\\nconsole.log(\'Hello code, incoming message is msg=%j\', msg);\\n\\n// Create message to be emitted\\nvar data = messages.newMessageWithBody({message: \'hello world\'});\\n\\n// Emit the data event\\nemitter.emit(\'data\', data);\\n\\n// No need to emit end\\nconsole.log(\'Finished execution\');"
},
"id": "step_2",
"selected_data_samples": [
"5a4b5902d6768500193ccb40"
],
"out_data_samples": [
"5a4b5902d6768500193ccb40"
]
}
],
"edges": [
{
"config": {
"mapper_type": "jsonata",
"mapper": {},
"condition": null
},
"source": "step_1",
"target": "step_2"
}
]
}
},
"type": "flow"
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment