tomky
(Tom)
October 27, 2017, 12:59pm
1
Hi!
I am new to this plugin and need your help.
This is what I do:
Create index:
PUT localhost:9200/myindex
And mappings:
PUT localhost:9200/myindex/mytype/_mapping
{
"messages": {
"properties": {
"subject": {"type": "string"},
"sender": {"type": "string"},
"receiver": {"type": "string"},
"body": {"type": "text"}
}
}
}
Now I create attachment by:
PUT http://localhost:9200/_ingest/pipeline/attachment
{
"description" : "Extract attachment information",
"processors" : [
{
"attachment" : {
"field" : "data",
"indexed_chars" : -1
}
}]
}
I add some data and it works fine with searching etc.
But when I add an attachment to my previously added data like this:
PUT http://localhost:9200/myindex/mytype/1?pipeline=attachment
{
"data": "some base64 data"
}
Then it overrides my whole previuosly added data and I am unable to search in my index.
What am I doing wrong? Please help.
spinscale
(Alexander Reelsen)
October 27, 2017, 3:40pm
2
Hey,
you need to supply the full document here and not just the field you want to add, when you use the Index API
--Alex
1 Like
dadoonet
(David Pilato)
October 27, 2017, 3:42pm
3
Ingest plugin does not support partial updates. So you need to provide the full JSON document:
{
"data": "BASE64 HERE",
"subject": "foo",
"sender": "foo",
"body": "foo"
}
PS: note that you should use text
in your mapping and not string
.
1 Like
dadoonet
(David Pilato)
October 27, 2017, 3:43pm
4
Sounds like @spinscale beat me on that one!
tomky
(Tom)
October 27, 2017, 5:46pm
7
When I want to use pipeline in PHP what should I do?
Code below doesn't work:
$params = [
'index' => 'myindex',
'type' => 'mytype',
'id' => '1',
'body' => [
'data' => 'BASE64_DATA',
'subject' => 'test',
'sender' => 'test',
'body' => 'test',
],
];
$client->ingest()->putPipeline($params);
tomky
(Tom)
October 27, 2017, 6:00pm
8
I found a solution.
I have to use 'pipeline' => 'attachment' in my $params and then index it normally.
system
(system)
Closed
November 24, 2017, 6:00pm
9
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.