Incremental value in document IDs


How do I have an incrementing field (counter) on document_id if I am using JDBC input?

The reason is that my statement is using left join on multiple tables and have duplicate of IDs. Using IDs for document_id will update the document to latest which is not what I desire.

I have my SQL statement as follow

SELECT (@row_number:=ifnull(@row_number, 0) + 1) AS num, ...

And at output

document_id => "%{carId}-%{num}"

But the output when I checked the IDs at Kibana doese not have increment value and remain as 1

Update 1:-
Resort to simple ruby script to have incremental count.
Found out that the Logstash output does not really follow SQL order by.
Is there anyway for me to force following inserting with order by?


See here.

Thanks for your reply and that link.

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