Reputation: 29997
I am trying to create a new index (elasticsearch 2.0.0-beta2
) together with mappings.
I am passing (either to pyelasticsearch
or elasticsearch.client
) the following mapping (this is a json.dumps
of the dict):
{
"mappings": {
"vulnerability": {
"_timestamp": {
"enabled": true,
"path": "HOST_START_iso"
},
"properties": {
"scan_name": {
"type": "string",
"index": "not_analyzed"
},
"severity": {
"type": "string",
"index": "not_analyzed"
},
"HOST_START_iso": {
"format": "epoch_millis||dateOptionalTime",
"type": "date"
}
}
}
}
}
The creation of the index fails with a TransportError(400, 'mapper_parsing_exception')
(below is the traceback for elasticsearch.client
, the mapping above is in mapping
)
Traceback (most recent call last):
File "C:/dev/Scans/L_build_vulns_index.py", line 38, in <module>
elasticsearch.client.IndicesClient(client=es).create(index=vulns_index, body=mapping)
File "C:\Python34\lib\site-packages\elasticsearch\client\utils.py", line 69, in _wrapped
return func(*args, params=params, **kwargs)
File "C:\Python34\lib\site-packages\elasticsearch\client\indices.py", line 102, in create
params=params, body=body)
File "C:\Python34\lib\site-packages\elasticsearch\transport.py", line 307, in perform_request
status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
File "C:\Python34\lib\site-packages\elasticsearch\connection\http_urllib3.py", line 89, in perform_request
self._raise_error(response.status, raw_data)
File "C:\Python34\lib\site-packages\elasticsearch\connection\base.py", line 105, in _raise_error
raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.RequestError: TransportError(400, 'mapper_parsing_exception')
I get this mapping from another index and I do not understand what is wrong with the the structure (I also tried to remove the outermost mappings
, the result is that the index is created, but without any mapping).
Note: this script used to work in the past, the only memorable change I can think of is an upgrade of elasticsearch
Upvotes: 1
Views: 225
Reputation: 217344
Note that in 2.0 the _timestamp
field has been deprecated.
The main issue, though, is that the path
property is no longer available (+ here).
Upvotes: 1