I'm working on a project using django-python. This has "oaisearch" installed to retrieve the metadata from different websites and "django_elasticsearch_dsl" to index them. It was verified that "oaisearch" runs without problems.
The problem occurs when "python3 manage.py search_index --create -f
" is run to start indexing.
The file "documents.py" that has the configuration of what you want to index is the following.
from elasticsearch_dsl import analyzer
from django_elasticsearch_dsl import DocType, Index
from oaisearch.models import Digital_Resources
digital_resources = Index('digital_resources')
digital_resources.settings(
number_of_shards=1,
number_of_replicas=0
)
html_strip = analyzer(
'html_strip',
tokenizer="standard",
filter=["standard", "lowercase", "stop", "snowball"],
char_filter=["html_strip"]
)
@digital_resources.doc_type
class Resources(DocType):
class Meta:
model = Digital_Resources
fields = [
#'oai_server',
'creator',
'title',
'subject',
'description',
'identifier',
]
The console failure message after executing the aforementioned command is as follows
Creating index 'digital_resources'
PUT http://localhost:9200/digital_resources [status:400 request:0.014s]
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.5/dist-packages/django_elasticsearch_dsl/management/commands/search_index.py", line 128, in handle
self._create(models, options)
File "/usr/local/lib/python3.5/dist-packages/django_elasticsearch_dsl/management/commands/search_index.py", line 84, in _create
index.create()
File "/usr/local/lib/python3.5/dist-packages/elasticsearch_dsl/index.py", line 203, in create
self.connection.indices.create(index=self._name, body=self.to_dict(), **kwargs)
File "/usr/local/lib/python3.5/dist-packages/elasticsearch/client/utils.py", line 76, in _wrapped
return func(*args, params=params, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/elasticsearch/client/indices.py", line 88, in create
params=params, body=body)
File "/usr/local/lib/python3.5/dist-packages/elasticsearch/transport.py", line 318, in perform_request
status, headers_response, data = connection.perform_request(method, url, params, body, headers=headers, ignore=ignore, timeout=timeout)
File "/usr/local/lib/python3.5/dist-packages/elasticsearch/connection/http_urllib3.py", line 186, in perform_request
self._raise_error(response.status, raw_data)
File "/usr/local/lib/python3.5/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: RequestError(400, 'mapper_parsing_exception', 'Root mapping definition has unsupported parameters: [doc : {properties={identifier={type=text}, creator={type=text}, subject={type=text}, description={type=text}, title={type=text}}}]')
What version of elasticsearch are you running? It looks like you are running elasticsearch 7.x which is not yet supported by your version of django_elasticsearch_dsl
. Try looking for a newer version or using elasticsearch 6.x.