I'm trying to convert my python ETLs to airflow. I have an ETL written in python to copy data from Elastic to MSSQL. I've build a DAG with 3 tasks.
task 1- get the latest date from the table in MSSQL
task 2- generate an elastic query based on that date retrieved from the previous task plus some filters (must not and sould) taken from a different table in MSSQL (less relevant). eventually generating a body like so:
{ "query": {
"bool": {
"filter": {
"range": {
"@timestamp": { "gt": latest_timestamp }
}
},
"must_not": [],
"should": [],
"minimum_should_match": 1
}
}
}
task 3- scroll the elastic index using the body generated in the previous task and write the data to mssql.
My DAG fails on the 3rd task with the error: parsing exception: Expected [START_OBJECT] but foud [START_ARRAY]
I've taken the generated body and ran it on elastic in dev tools and it is working fine. So I have no idea what is the problem and how to debug it. Any ideas?