question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

5.4.0 New 'pipeline' metadata key should be '_pipeline'

See original GitHub issue

Upgrading from 5.3 to 5.4 broke my ETL because i already have a field ‘pipeline’ in my batch submissions. Metadata fields are always prefixed with ‘_’ so I can avoid colliding with them. Why not ‘_pipeline’?

Traceback (most recent call last):
  File "/opt/geostellar_com/etl/geostellar_etl/__init__.py", line 546, in checkpoint
    self.submit(results[:self.batch_size])
  File "/opt/geostellar_com/etl/geostellar_etl/load/__init__.py", line 233, in submit
    bulk(self.destination, batch)
  File "/opt/anaconda2/lib/python2.7/site-packages/elasticsearch/helpers/__init__.py", line 195, in bulk
    for ok, item in streaming_bulk(client, actions, **kwargs):
  File "/opt/anaconda2/lib/python2.7/site-packages/elasticsearch/helpers/__init__.py", line 163, in streaming_bulk
    for result in _process_bulk_chunk(client, bulk_actions, raise_on_exception, raise_on_error, **kwargs):
  File "/opt/anaconda2/lib/python2.7/site-packages/elasticsearch/helpers/__init__.py", line 92, in _process_bulk_chunk
    raise e
RequestError: TransportError(400, u'illegal_argument_exception', u'Malformed action/metadata line [1], expected a simple value for field [pipeline] but found [START_OBJECT]')

Much appreciated, Thatcher

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
fxdgearcommented, Oct 5, 2017

@thatcher so the pipeline is a reserved word in the Elasticsearch API. Not anything that is done wrt to the python client.

https://github.com/elastic/elasticsearch/blob/master/rest-api-spec/src/main/resources/rest-api-spec/api/bulk.json#L56-L58

I’m going to close this issue since it’s not to do with the python client but rather Elasticsearch instead.

A work around for you to try would be to specify the doc type in your bulk action

something like this:

batch = [{
    '_op_type': 'index',
    '_index': 'foo',
    '_type': 'bar',
    '_id': 'doc-000',
    'doc': {
        'title': 'Deal John Doe, Montana, Ranch',
        'pipeline': {
            'Organic Lead': 100,
            'Engagement': 50,
            'Proposal': 25
        },
    }
}, {
    '_op_type': 'index',
    '_index': 'foo',
    '_type': 'bar',
    '_id': 'doc-001',
    'doc': {
        'title': 'Deal Jane Doe, Florida, Condo',
        'pipeline': {
            'Organic Lead': 200,
            'Engagement': 80,
            'Proposal': 45
        },
    }
}]
1reaction
thatchercommented, Oct 5, 2017

Sure thanks. With elasticsearch-py 5.3.0 this works, with 5.4.0 it breaks with the stacktrace above.

from elasticsearch import Elasticsearch
from elasticsearch.helpers import bulk


connection = Elasticsearch(
    hosts=['localhost:9200'],
)
connection.indices.delete(
    index='foo',
    ignore=[400, 404],
)
connection.indices.create(
    index='foo',
    ignore=[400, 404],
)

batch = [{
    '_op_type': 'index',
    '_index': 'foo',
    '_type': 'bar',
    '_id': 'doc-000',
    'title': 'Deal John Doe, Montana, Ranch',
    'pipeline': {
        'Organic Lead': 100,
        'Engagement': 50,
        'Proposal': 25
    },
}, {
    '_op_type': 'index',
    '_index': 'foo',
    '_type': 'bar',
    '_id': 'doc-001',
    'title': 'Deal Jane Doe, Florida, Condo',
    'pipeline': {
        'Organic Lead': 200,
        'Engagement': 80,
        'Proposal': 45
    },
}]
bulk(connection, batch)
Traceback (most recent call last):
  File "pipeline_meta_field_issue.py", line 42, in <module>
    bulk(connection, batch)
  File "/opt/anaconda2/lib/python2.7/site-packages/elasticsearch/helpers/__init__.py", line 195, in bulk
    for ok, item in streaming_bulk(client, actions, **kwargs):
  File "/opt/anaconda2/lib/python2.7/site-packages/elasticsearch/helpers/__init__.py", line 163, in streaming_bulk
    for result in _process_bulk_chunk(client, bulk_actions, raise_on_exception, raise_on_error, **kwargs):
  File "/opt/anaconda2/lib/python2.7/site-packages/elasticsearch/helpers/__init__.py", line 92, in _process_bulk_chunk
    raise e
elasticsearch.exceptions.RequestError: TransportError(400, u'illegal_argument_exception', u'Malformed action/metadata line [1], expected a simple value for field [pipeline] but found [START_OBJECT]')
Read more comments on GitHub >

github_iconTop Results From Across the Web

PublishPipelineMetadata@0 - Publish Pipeline Metadata v0 task
In this article. Syntax; Inputs; Output variables; Requirements. Use this task to publish Pipeline Metadata to the Evidence store. Syntax.
Read more >
Changelog — Elasticsearch DSL 5.4.0 documentation
Metadata fields (such as id, parent, index, version etc) must be stored (and retrieved) using the meta attribute (#58) on both Result and...
Read more >
Accessing data in pipelines | Elasticsearch Guide [master]
Accessing data in pipelinesedit. See Access source fields in a processor, Access metadata fields in a processor, and Access ingest metadata in a...
Read more >
Login failures after upgrading saml-plugin from 1.1.7 to 2.0.0
>I had the same issue with Idaptive, I moved from manual metadata configuration on idP to /securityRealm/metadata and it started working then. I...
Read more >
Fusion 5.4.0 Release Notes - Lucidworks Documentation
A new stage for the Index Pipeline, Text Processing, ... Detect Language index stage has new features enabled by these configuration keys:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found