Jdbc plugin : column with xml content

I am importing a MS SQL table with an column that contains xml

those are values example:

<actor>
  <actor last_name="COSTNER" first_name="Kevin" />
  <actor last_name="DICAPRIO" first_name="Leonardo" />
</actor>
...
<actor>
  <actor last_name="PACINO" first_name="Al" />
  <actor last_name="GOSLINE" first_name="Bryan" />
  <actor last_name="MOYER" first_name="Stephen" />
</actor>

...

I would like to export that column to an elastic search field that would be in this object format:

 "actors": [
            {
              "first_name": "Kevin",
              "last_name": "COSTNER"
            },
            {
               "first_name": "Leonardo",
              "last_name": "DICAPRIO"
            }
          ]

Do you know if there is a way?

Have a look at the xml filter.

xml  {
	    source => "columnName"
	    xpath => [ "//actor/@last_name", "last_name" ]
	    xpath => [ "//actor/@first_name", "first_name" ]
		target => "fieldName"	   
   }

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