Convert a Json array of object ([{},{},{}] - this format) to {[],[],[]}

Hi

I have a Json I/P which looks like:

{
	"data": { 
		"arrayField" :[ {"id" : 7,"data" : "a"},{"id" : 3,"data" : "b"}],
		"field1" : "value1"	
	}
}

Where arrayField can contain any number of element.

I want to access the arrayField inside elasticsearch script which needs a format like {["id" : 7,"data" : "a"],["id" : 3,"data" : "b"]}.

How can I do this conversion ?

Hello,

you can use split filter,
Ex:-
filter {
split {
field => "arrayField"
}
}

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