1
elasticsearch 2.3.4 및 python을 사용하여 PDF를 인덱싱하려고합니다. pdf에서 텍스트와 메타 데이터를 추출하여 색인화하고 싶습니다. mapper_attachment 플러그인 사용.elasticsearch에서 PDF를 인덱싱 할 때 mapper_parsing_exception 오류가 발생했습니다.
색인을 생성하려고 할 때 'mapper_parsing_exception'오류가 발생합니다.
Traceback (most recent call last):
File "C:/Users/537095/Desktop/QA/IndexingWorkspace/MainWorkspace/index3.py", line 51, in <module>
es.index(index = INDEX_NAME, body = data_dict ,doc_type = "attachment", id=1)
File "C:\Python27\lib\site-packages\elasticsearch\client\utils.py", line 69, in _wrapped
return func(*args, params=params, **kwargs)
File "C:\Python27\lib\site-packages\elasticsearch\client\__init__.py", line 261, in index
_make_path(index, doc_type, id), params=params, body=body)
File "C:\Python27\lib\site-packages\elasticsearch\transport.py", line 329, in perform_request
status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
File "C:\Python27\lib\site-packages\elasticsearch\connection\http_urllib3.py", line 106, in perform_request
self._raise_error(response.status, raw_data)
File "C:\Python27\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)
RequestError: TransportError(400, u'mapper_parsing_exception', u'failed to parse')
내가 뭔가 잘못을하고 있습니까 : 다음은
#Configuration
DIR = 'D:/QA_Testing/testing/data'
ES_HOST = {"host" : "localhost", "port" : 9200}
INDEX_NAME = 'testing'
TYPE_NAME = 'documents'
URL = "D:/xyz.pdf"
es = Elasticsearch(hosts = [ES_HOST])
mapping = {
"mappings": {
"documents": {
"properties": {
"cv": { "type": "attachment" }
}}}}
file64 = open(URL, "rb").read().encode("base64")
data_dict = {'cv': file64}
data_dict = json.dumps(data_dict)
res = es.indices.create(index = INDEX_NAME, body = mapping)
es.index(index = INDEX_NAME, body = data_dict ,doc_type = "attachment", id=1)
ERROR, 내 코드?
'DOC_TYPE = "첨부 파일"'해야'DOC_TYPE = "문서"'한다, 당신의
doc_type
을 변경해야합니다. 또한 ES 서버 로그에 표시되는 오류를 표시 할 수 있습니까? – Val대단히 감사합니다! 내 어리석은 실수. 그 일하는 지금 :) – pavancs