Adding field to column-Mysql


(Groot) #1

Hi,
I have a mysql table having column name as name, fathername, dob, age, address, dateofjoining, currentlocation.
I want to add a field i.e. employee and filter data as attached. I have some idea about mutate, but how do I filter these value to a new field called employee?
Please let me know the solution. Thanks you for the help!log


#2

@vineets928 use mutate filter as below. It will create desired json structure.

mutate{
add_field => {"[employee][name]"=>"%{name}"}
add_field => {"[employee][fathername]"=>"%{fathername}"}
}

(Groot) #3

@karanshah Thanku so much...it worked.

I got the desired json output, and I am getting the json like
"employee":{
"name": "%{name}",
"fathername":"%{fathername}",
}
But here problem is that why field and value are same.Why I am not getting the value of table?

Plz help


(Groot) #4

@karanshah Issue resolved

Problem is with mapping.

Thanks :slight_smile:


(Groot) #5

@karanshah @magnusbaeck I have 2 tables i.e. employee and address and employee has one-to-many relationship with address. I joined both tables on unique id as each address has unique id of its own Now, I want json output as

hmm.

Please help...Thanks in advance


(system) #6

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