2014-12-04 4 views
0

나는 오류없이 다음 파이썬 코드를 실행하지만 지금이Elasticsearch TransportError (400, u'MapperParsingException

TransportError(400, u'MapperParsingException [Analyzer [whitespace_analyzer] not found for field [job style]]' 

코드가 오전 것은이 있습니다.

from elasticsearch import Elasticsearch 
import xlrd 

es = Elasticsearch() 



es.indices.create("we_doing",body={ 
     'settings': { 
     "analysis": { 
     "tokenizer":{ 
      "camel":{ 
        "type": "pattern", 
        "pattern":"([^\\\\p{L}\\\\d]+)|(?<=\\\\D)(?=\\\\d)|(?<=\\\\d)(?=\\\\D)|(?<=[\\\\p{L}&&[^\\\\p{Lu}]])(?=\\\\p{Lu})|(?<=\\\\p{Lu})(?=\\\\p{Lu}[\\\\p{L}&&[^\\\\p{Lu}]])" 
       }}, 

    "analyzer": { 
     "nGram_analyzer": { 
      "type": "custom", 
      "tokenizer": ["whitespace","camel"], 
      "filter": [ 
       "lowercase", 
       "asciifolding" 

      ] 
     }, 
     "whitespace_analyzer": { 
      "type": "custom", 
      "tokenizer": ["whitespace","camel"], 
      "filter": [ 
       "lowercase", 
       "asciifolding" 
      ] 
     }}}}}, ignore = 400) 

mapping = { 
"we_data": { 

    "properties": { 
     "job id": {"type": "string", "index": "not_analyzed"}, 

     "job style":{ 
     "type":"string", 

     "index_analyzer": "nGram_analyzer", 
     "search_analyzer": 'whitespace_analyzer', 


    }, 

     "location": {"type": "string", "index": "not_analyzed"}, 
     "experience": {"type": "string", "index": "not_analyzed"}, 
     "post date": {"type": "string", "index": "not_analyzed"}, 
     "job description": {"type": "string", "index": "not_analyzed"}, 

    }}} 


es.indices.put_mapping(index="we_doing", doc_type="we_data", body=mapping) 

그것은 완벽하게 작동했다 이제 나는 많은 어려움에 처해있다 .2 일 안에 살아야한다. 도움을 청해야한다.

+0

작동하지 않으려면 어떻게 했습니까? 이런 종류의 문제는 혼자서 발생하지 않습니다. 그들은 인간의 도움이 필요합니다! – eliasah

+0

내 기억에 나는 아무 것도하지 않았다. 만약 내가 표준 분석기 specyfing 오전 일하고있다. 커스텀 분석기를 가져 오지 않는 이유는 무엇입니까 ??? 도와주세요 . – user3368375

+0

curl 명령을 사용하여 원시 json 매핑을 보내려고 했습니까? – eliasah

답변