Elasticsearch-dsl-py: init() fails: Root mapping definition has unsupported parameters

Created on 17 May 2019  路  1Comment  路  Source: elastic/elasticsearch-dsl-py

Elasticsearch version: 6.6.2
Also fails for the example given: https://elasticsearch-dsl.readthedocs.io/en/latest/#persistence-example

Code:

from elasticsearch_dsl import connections, Document, Keyword

connections.create_connection(hosts=['elasticsearch'])

class D(Document):
    tags = Keyword(multi=True)
    class Index:
        name = 'i'

D.init()
D(tags=['a', 'b', 'c']).save(refresh=True)

# now any of these searches will return our document
D.search().filter('term', tags='a').count()
D.search().filter('term', tags='b').count()
D.search().filter('term', tags='c').count()

Error:

Traceback (most recent call last):
  File "test.py", line 10, in <module>
    D.init()
  File "/opt/app-root/lib/python3.6/site-packages/elasticsearch_dsl/document.py", line 136, in init
    i.save(using=using)
  File "/opt/app-root/lib/python3.6/site-packages/elasticsearch_dsl/index.py", line 270, in save
    return self.create(using=using)
  File "/opt/app-root/lib/python3.6/site-packages/elasticsearch_dsl/index.py", line 254, in create
    self._get_connection(using).indices.create(index=self._name, body=self.to_dict(), **kwargs)
  File "/opt/app-root/lib/python3.6/site-packages/elasticsearch/client/utils.py", line 84, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/opt/app-root/lib/python3.6/site-packages/elasticsearch/client/indices.py", line 105, in create
    "PUT", _make_path(index), params=params, body=body
  File "/opt/app-root/lib/python3.6/site-packages/elasticsearch/transport.py", line 353, in perform_request
    timeout=timeout,
  File "/opt/app-root/lib/python3.6/site-packages/elasticsearch/connection/http_urllib3.py", line 239, in perform_request
    self._raise_error(response.status, raw_data)
  File "/opt/app-root/lib/python3.6/site-packages/elasticsearch/connection/base.py", line 168, in _raise_error
    status_code, error_message, additional_info
elasticsearch.exceptions.RequestError: RequestError(400, 'mapper_parsing_exception', 'Root mapping definition has unsupported parameters:  [tags : {type=keyword}]')

Most helpful comment

If you are using Elasticsearch 6.x you need to also use the 6.x version of the library.

>All comments

If you are using Elasticsearch 6.x you need to also use the 6.x version of the library.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vanzi picture vanzi  路  4Comments

vmogilev picture vmogilev  路  4Comments

ypkkhatri picture ypkkhatri  路  4Comments

njoannin picture njoannin  路  3Comments

berinhard picture berinhard  路  3Comments