taraslayshchuk / es2csv

Export from an Elasticsearch into a CSV file
Apache License 2.0
513 stars 190 forks source link

Getting unrecognized parameter: [_source_include] with Elastic 7.3 and using -f to specify fields #76

Open prashanttct07 opened 5 years ago

prashanttct07 commented 5 years ago

after installing es2csv I tried to run it against public ES cluster with version 7.3 and specifying explicit fields to be returned as -f:

es2csv -u https://localhost:9200/ -a user:pwd -i logstash-* -r -q '{"query": {"match_all": {}}}' --verify-certs --ca-certs /etc/logstash/elasticCA.crt -f message -o dump.csv

I get

ge -o dump.csv_3
Traceback (most recent call last):
  File "/usr/local/bin/es2csv", line 11, in <module>
    load_entry_point('es2csv==5.5.2', 'console_scripts', 'es2csv')()
  File "/usr/local/lib/python2.7/dist-packages/es2csv_cli.py", line 53, in main
    es.search_query()
  File "/usr/local/lib/python2.7/dist-packages/es2csv.py", line 26, in f_retry
    return f(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/es2csv.py", line 126, in search_query
    res = self.es_conn.search(**search_args)
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/utils.py", line 73, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/__init__.py", line 632, in search
    doc_type, '_search'), params=params, body=body)
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/transport.py", line 312, in perform_request
    status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/connection/http_urllib3.py", line 129, in perform_request
    self._raise_error(response.status, raw_data)
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/connection/base.py", line 125, in _raise_error
    raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.RequestError: TransportError(400, u'illegal_argument_exception', u'request [/logstash-*/_search] contains unrecognized parameter: [_source_include] -> did you mean any of [_source_includes, _source_excludes]?')

Is this an issue cause of 7.3 or I am missing something?

rc9000 commented 5 years ago

It's fixed by the PR @gboddin provided: https://github.com/taraslayshchuk/es2csv/pull/71

Unfortunately you'll have to apply it yourself, or install from https://github.com/gboddin/es2csv/tree/es-7.0