I'm facing an issue where data is not being inserted into Neo4j when using the io.kestra.plugin.neo4j.Batch task in a Kestra workflow. The task executes without errors, but the Neo4j database remains empty.
Steps to Reproduce:
Set Up Docker Environment: Use the following docker-compose.yml file to set up the environment:
id: ELK_To_Neo4j
namespace: ai.team
tasks:
- id: ELK
type: io.kestra.plugin.elasticsearch.Search
description: Extract data from Elasticsearch
connection:
headers: []
hosts:
- http://172.27.0.6:9200/
indexes:
- people
request:
query:
match_all: {}
- id: "transform_data"
type: io.kestra.plugin.scripts.python.Commands
inputFiles:
data.json: |
{{ outputs.ELK | json }}
transform_script.py: |
from kestra import Kestra
import json
import sys
# Load Elasticsearch data
with open(sys.argv[1], 'r') as f:
raw_data = f.read()
es_data = json.loads(raw_data)
print("es_data:", json.dumps(es_data))
transformed_data = []
for person in es_data.get('rows', []):
name = person.get('name')
if not name:
print(f"Skipping entry with missing name: {person}")
continue
transformed_person = {
'name': name.upper(),
'age': person.get('age', 0) + 1
}
transformed_data.append(transformed_person)
print("Filtered transformed_data:", json.dumps(transformed_data))
output_data = {'props': transformed_data}
Kestra.outputs({'transformed_data': transformed_data})
with open('transformed_data.json', 'w') as f:
json.dump(output_data, f)
beforeCommands:
- pip install requests kestra > /dev/null
commands:
- python transform_script.py data.json
outputFiles:
- transformed_data.json
- id: "neo4j"
type: io.kestra.plugin.neo4j.Batch
description: "Insert transformed data into Neo4j"
url: bolt://172.27.0.5:7687
username: neo4j
password: test12345678
chunk: 1000
from: "{{ outputs.transform_data.outputFiles['transformed_data.json'] }}"
query: |
UNWIND $props AS row
WITH row
WHERE row.name IS NOT NULL
MERGE (p:Person {name: row.name})
ON CREATE SET p.age = row.age, p.created_at = timestamp()
ON MATCH SET p.age = row.age, p.updated_at = timestamp()
RETURN p.name AS name, p.age AS age, p.created_at, p.updated_at
Expected Behavior:
The neo4j task should insert the transformed data into the Neo4j database, creating or updating nodes with the label Person and the appropriate properties.
Actual Behavior:
The neo4j task executes without errors but reports:
Successfully bulk 1 queries with 0 updated rows
Additional Information:
The neo4j_test task using io.kestra.plugin.neo4j.Query works and can insert data:
Description:
I'm facing an issue where data is not being inserted into Neo4j when using the io.kestra.plugin.neo4j.Batch task in a Kestra workflow. The task executes without errors, but the Neo4j database remains empty.
Steps to Reproduce:
Set Up Docker Environment: Use the following docker-compose.yml file to set up the environment:
Create a Kestra Workflow:
Expected Behavior:
The neo4j task should insert the transformed data into the Neo4j database, creating or updating nodes with the label Person and the appropriate properties. Actual Behavior: The neo4j task executes without errors but reports:
Successfully bulk 1 queries with 0 updated rows
Additional Information:
The neo4j_test task using io.kestra.plugin.neo4j.Query works and can insert data:
However, using the Batch task does not insert data into Neo4j.
Attempts to Resolve: