Composite ID


(Teddy) #1

I require a way to create a composite key for the document in elastic search through logstash corresponding to the composite key in my MySQL database.


(David Pilato) #2

I believe it's more a #logstash question so I moved your question.


(Magnus Bäck) #3

Assuming you have the key in a field in each event, just reference that field with the %{fieldname} notation in the elasticsearch output's document_id option.


(Teddy) #4

Thanks!


(Teddy) #5

But by using document_id, we would be rewriting elasticsearch default id section.
My requirement is as follow

Screenshot (1)

This is the description of my table, and i need the primary key associated with this table as it is in my elasticsearch.


(Magnus Bäck) #6

But by using document_id, we would be rewriting elasticsearch default id section.

Yes. What's the problem with that?

If you for some reason want to keep ES's autogenerated document id but additionally have your own field that acts as a document key that's fine too, just use a mutate filter to add a new field with the contents of the other fields.


(Teddy) #7

Thanks


(system) #8

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