2017-03-08 4 views
0

私はpython-elastic-searchをputmappingしようとしています。私のコードで大文字と小文字を区別したマッピングを追加したいと思います。マッピングを確認して助けてください。 500トランスポートエラーnot_x_content_exceptionを取得しています。ElasticSeachマッピングエラーが発生しました

mapping = ''' 
{ 
    "settings": { 
     "index": { 
      "analysis": { 
       "analyzer": { 
        "analyzer_keyword": { 
         "tokenizer": "keyword", 
         "filter": "lowercase" 
        } 
       } 
      } 
     } 
    }, 
    "mappings": { 
     "countrycpm": { 
      "properties": { 
       "uid": { 
        "type": "text" 
       }, 
       "country": { 
        "type": "text" 
       }, 
       "cpm": { 
        "type": "float" 
       }, 
       "createdby": { 
        "type": "text" 
       }, 
       "updatedby": { 
        "type": "text" 
       }, 
       "createddate": { 
        "type": "date", 
        "format": "yyyy-MM-dd HH:mm:ss.SSS" 
       }, 
       "updateddate": { 
        "type": "date", 
        "format": "yyyy-MM-dd HH:mm:ss.SSS" 
       }, 
       "status = mode": { 
        "type": "integer" 
       }, 
       "createdbyname": { 
        "type": "text" 
       }, 
       "updatedbyname": { 
        "type": "text" 
       } 
      } 
     } 
    } 
} 
''' 

els.indices.put_mapping(index = ES_INDEX, doc_type = 'countrycpm',body=json.dumps(mapping)) 

応答

TransportError       Traceback (most recent call last) 
<ipython-input-57-4c3baa9096ca> in <module>() 
----> 1 els.indices.put_mapping(index = ES_INDEX, doc_type = 'countrycpm',body=json.dumps(map)) 

/usr/local/lib/python2.7/dist-packages/elasticsearch/client/utils.pyc in _wrapped(*args, **kwargs) 
    67     if p in kwargs: 
    68      params[p] = kwargs.pop(p) 
---> 69    return func(*args, params=params, **kwargs) 
    70   return _wrapped 
    71  return _wrapper 

/usr/local/lib/python2.7/dist-packages/elasticsearch/client/indices.pyc in put_mapping(self, doc_type, body, index, params) 
    289     raise ValueError("Empty value passed for a required argument.") 
    290   _, data = self.transport.perform_request('PUT', _make_path(index, 
--> 291    '_mapping', doc_type), params=params, body=body) 
    292   return data 
    293 

/usr/local/lib/python2.7/dist-packages/elasticsearch/transport.pyc in perform_request(self, method, url, params, body) 
    305 
    306    try: 
--> 307     status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout) 
    308 
    309    except TransportError as e: 

/usr/local/lib/python2.7/dist-packages/elasticsearch/connection/http_urllib3.pyc in perform_request(self, method, url, params, body, timeout, ignore) 
    91   if not (200 <= response.status < 300) and response.status not in ignore: 
    92    self.log_request_fail(method, url, body, duration, response.status) 
---> 93    self._raise_error(response.status, raw_data) 
    94 
    95   self.log_request_success(method, full_url, url, body, response.status, 

/usr/local/lib/python2.7/dist-packages/elasticsearch/connection/base.pyc in _raise_error(self, status_code, raw_data) 
    103    pass 
    104 
--> 105   raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info) 
    106 
    107 

TransportError: TransportError(500, u'not_x_content_exception') 

答えて

0

あなたがインデックスに、このようなマッピングを更新することはできません、あなたがした新しいマッピングを作成し、削除したことを他のための新たな変数として、このマッピングを割り当てますインデックスを作成し、それに応じて更新します。

関連する問題