[PHP] Problems with JSON processor


(evert) #1

I am having some problems to make JSON proccessor work.

Here is what I am trying, as of docs:

$params = [
    'id' => 'encode_json',
    'body' => [
        'description' => 'Extract attachment information',
        'processors' => [
            [
                'json' => [
                    'field' => '{{ authors }}',
                    'target_field' => 'attachment.authors'
                ]
            ],

        ]
    ]
];
return $client->ingest()->putPipeline($params);

Some other processor are already working, as below:

$params = [
    'id' => 'attachment',
    'body' => [
        'description' => 'Extract attachment information',
        'processors' => [
            [
                'attachment' => [
                    'field' => 'content',
                    'indexed_chars' => -1
                ]                        
            ],
            [
                'set' => [
                    'field' => 'attachment.author',
                    'value' => '{{ author }}'
                ]
            ],
            [
                'remove' => [
                    'field' => 'author'
                ]
            ],
            ]
        ]
    ]
];
return $client->ingest()->putPipeline($params);

But when it comes to the attachment.author it brings as string... I need as json/array.

I am using ES 5.0 with ES oficial PHP Client.

Thanks for any help.


(system) #2

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