SigmaUI icon indicating copy to clipboard operation
SigmaUI copied to clipboard

Import Index issue

Open Cyb3rSn0rlax opened this issue 4 years ago • 2 comments

Hello, Context: kibana 7.6.1 with opendistro plugin for security.

When i try run the import_es_index.py i get this error : python2 import_es_index.py

{u'acknowledged': True}
1 / 281 UZ3knmUBtApo-eN_puWZ
Traceback (most recent call last):
  File "import_es_index.py", line 39, in <module>
    import_index(SIGMA_DOC_INDEX_NAME+'_index.json', SIGMA_DOC_INDEX_NAME)
  File "import_es_index.py", line 31, in import_index
    es_dbc.insert_doc(index_name, doc_id, doc)
  File "/home/user/SigmaUI/ELK_import_export/es_db_connector.py", line 54, in insert_doc
    res = self.es.index(index=index, doc_type=index, id=doc_id, body=doc)
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/utils.py", line 92, in _wrapped
    return func(*args, params=params, headers=headers, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/__init__.py", line 411, in index
    body=body,
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/transport.py", line 362, in perform_request
    timeout=timeout,
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/connection/http_urllib3.py", line 252, in perform_request
    self._raise_error(response.status, raw_data)
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/connection/base.py", line 282, in _raise_error
    status_code, error_message, additional_info
elasticsearch.exceptions.RequestError: RequestError(400, u'illegal_argument_exception', u'Rejecting mapping update to [sui_sigma_doc] as the final mapping would have more than 1 type: [_doc, sui_sigma_doc]')

My es_config.py :

ES_host = ['localhost']
ES_http_auth = ('user', 'pass')
ES_port = 9200
ES_scheme = "https" # "http" or "https"

### if X-Pack is NOT installed
### use these configs
ES_use_ssl=True
ES_verify_certs=True
ES_ca_certs='/etc/elasticsearch/root-ca.pem'

### if X-Pack IS installed
## use these configs
#ES_use_ssl=True
### make sure we verify SSL certificates
#ES_verify_certs=False
### provide a path to CA certs on disk
#ES_ca_certs='/path/to/certs/cas.crt'

SIGMA_DOC_INDEX_NAME = "sui_sigma_doc"

Cyb3rSn0rlax avatar May 19 '20 03:05 Cyb3rSn0rlax

I am also having this issue

pritster5 avatar Dec 01 '21 19:12 pritster5

This can be fixed by changing line 54 in es_db_connector.py: "res = self.es.index(index=index, doc_type=index, id=doc_id, body=doc)".

Change "doc_type=index" to doc_type="_doc"

pritster5 avatar Jan 14 '22 16:01 pritster5