Multiple output sequence

I have two output,the first is http-output,and the second is Elasticsearch-output.

What i want to do is execute http-output before Elasticsearch-output.
How can i do that?
The problem I have is this I need delete it before I insert into Elasticsearch,but I can't determine document_id, i just hava some field.
This is my config fragment

output {

	http {
		url => "http://localhost:9200/image_index/_delete_by_query?pretty"
		content_type => "application/json"
		format => "message"
		http_method => "post"
		message => '{"query":{"term":{"artId":"%{artId}"}}}'
	}
  
	elasticsearch {
		hosts => ["http://localhost:9200"]
		document_type => "_doc"
		index => "image_index"
		document_id => "%{id}"
	}
	
}

Or there are other solutions to antipathy?

I need to delete every piece of data that is about to be inserted.
For example,The data queried from the database is like this

id		artId		price
88		12	 	3.0	
89		12	 	3.0	
90		66	 	3.0	
...

and now the old data stored in the Elasticsearch is like this

{
"id" : "100",
"artId" : 12,
"price" : 4.0
},
{
"id" : "101",
"artId" : 12,
"price" : 8.0
},
{
"id" : "120",
"artId" : 12,
"price" : 9.0
},
{
"id" : "130",
"artId" : 66,
"price" : 9.0
},
{
"id" : "132",
"artId" : 88,
"price" : 2.2
}
...

Before I insert new data, I need delete eligible data from the Elasticsearch, because I don't know the document_id which one I need to delete ,so I had to use http-output to delete these data which artId is '12' or '66', and then insert into Elasticsearch by these data queried from the database.
I wonder if I have described all of that clearly enough.

You cannot control the order of execution.

Have you considered using artId as the document_id, so that the old value is overwritten?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.