Field search using Logstash configuration

Hi ,
Below is my requirement.
I have two indexes

  1. Index : Client_one [fields : employee_no1,salary, exp]
  2. Index: client_two. [fields " employee_no2, total_exp]

Both index have one common field employee_no.
I want to sync if employee no1(from client_one index) == employee_no2(from client_two index) then insert salary in client_two index.

how to achieve this using logstash config.

I tried below but doesn't work as expected.

Blockquote

input {
       elasticsearch 
	   {
			hosts => ["http://localhost:9200/"]
			index => "client_one"
			query => '{ "query": { "match_all": { } }, "sort": [ "_doc" ] }'
			docinfo => true
	   }
}
filter 
{
	
		mutate
		{
			copy => { "employee_no1" => "emp_number" } 
		}
	elasticsearch 
	{
 
		hosts => ["http://localhost:9200/"]
		index => "client_two"
		
		fields => {
       	"employee_no2" => "emp_num"
        "salary" => "salary_new"
		
     }
	}
		
	if([emp_number]== [emp_num])
	{
		mutate 
		{
			add_field => [ "total_sal", "%{[salary_new]}" ]
		}
	} 
}  
output { 
			stdout {}  
			stdout {codec => rubydebug}
		    elasticsearch {
							index => "client_two"
							hosts => ["http://localhost:9200/"]
				            #action => "create"
																										
					} 
}  



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