Logstash JDBC Input - SQL Query

Hi all,

I have a table where the data is in the following manner :

My requirement is a documnet on Elastic Search that is like :

"_index" : "Library",
"_type" : "books",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"libraryid" : 1,
"books" :
{ "id": "1", "performance": "60%","Yieldvalue":"0.78" },
{ "id": "2","performance": "40%","Yieldvalue":"0.79" },
{ "id": "3", "performance": "30%","Yieldvalue":"0.38" }
"@version" : "1",
"@timestamp" : "2016-02-15T13:38:56.023Z"

Using JDBC input plugin , i can only give a SQL query which takes the data from table and create documents on ES.
How can i achieve this kind of documents from table similar to above ? Please help.

Can filters plugins in Logstash help ? If yes , kindly point me to that filter.

If that's still relevant, I am using sql server and I've prepared query in a manner where I bring back nested documents as xml structure and using xml filter create nested documents out of it

Just use aggregate filter plugin.