[英]Creating a new ElasticSearch index with mapping
我可以執行以下操作來創建新的ES索引:
>>> es.indices.create(index = 'example_index')
{u'index': u'example_index', u'acknowledged': True, u'shards_acknowledged': True}
但是,如果添加任何類型的映射,都會出現未知錯誤。 例如:
request_body = {
'mappings': {
'_doc': {
'properties': {
'address': {'index': 'not_analyzed', 'type': 'string'},
'some_PK': {'index': 'not_analyzed', 'type': 'string'},
}}}
}
es.indices.create(index = 'example_index', body=request_body)
> TransportError: <unprintable TransportError object>
如何在此處使用預定義的映射創建適當的索引? 為什么會給出這樣無益的錯誤消息?
雖然我只是嘗試連接到外部ES服務器,但我認為我不需要在本地安裝它,但是在本地安裝並確保已安裝Java可以解決上述問題。
看來,即使不使用本地ElasticSearch集群, Elasticsearch
模塊可能也需要在本地安裝java
和ElasticSearch
進行某些調用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.