我想映射Elasticsearch上的JSON結構,但似乎是錯誤的,因爲當我從我的Windows提示符啓動curl命令沒有附加除了下劃線脈衝。無法加載JSON映射Elasticsearch
我使用curl命令:
curl -H "Content-Type: application/json" -XPUT http://localhost:9200/technogym -d "{\"mappings\":{\"id\":{\"type\":\"string\"},\"key\":{\"type\":\"string\"},\"value\":{\"type\":\"object\",\"properties\":{\"rev\":{\"type\":\"string\"}}},\"doc\":{\"type\":\"object\",\"properties\":{\"_id\":{\"type\":\"string\"},\"_rev\":{\"type\":\"string\"},\"userID\":{\"type\":\"string\"},\"conversation_id\":{\"type\":\"string\"},\"input\":{\"type\":\"object\",\"properties\":{\"text\":{\"type\":\"string\"}}},\"output\":{\"type\":\"object\",\"properties\":{\"text\":{\"type\":\"string\"}}},\"node_visited\":{\"type\":\"string\"},\"intents\":{\"properties\":{\"intent\":{\"type\":\"string\"},\"confidence\":{\"type\":\"string\"}}},\"entities\":{\"type\":\"object\",\"properties\":{\"entity\":{\"type\":\"string\"},\"location\":{\"type\":\"string\"},\"value\":{\"type\":\"string\"},\"confidence\":{\"type\":\"string\"}}},\"timestamp\":{\"type\":\"date\"}}}}}"
這裏我jsonwith映射(只是爲了使其更具可讀性):
編輯
{"mappings": {
"_default_": {
"properties": {
"id": {
"type": "string"
},
"key": {
"type": "string"
},
"value": {
"type": "object",
"properties": {
"rev": {
"type": "string"
}
}
},
"doc": {
"type": "object",
"properties": {
"_id": {
"type": "string"
},
"_rev": {
"type": "string"
},
"userID": {
"type": "string"
},
"conversation_id": {
"type": "string"
},
"input": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
}
},
"output": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
}
},
"node_visited": {
"type": "string"
},
"intents": {
"properties": {
"intent": {
"type": "string"
},
"confidence": {
"type": "string"
}
}
},
"entities": {
"type": "object",
"properties": {
"entity": {
"type": "string"
},
"location": {
"type": "string"
},
"value": {
"type": "string"
},
"confidence": {
"type": "string"
}
}
},
"timestamp": {
"type": "date"
}
}
}
}
}}}
我不知道爲什麼我能上傳這個映射。
感謝您的任何幫助。
謝謝;)。是的,我編輯了正確的JSON,因爲在我的右邊有一個「映射」而不是「映射」。感謝您的幫助,它已經成爲非常有用的 –
偉大的,它爲你工作。如果您想先創建索引(相當於RDBMS中的數據庫名稱),然後鍵入映射,那麼請遵循第一個答案,否則您的做法也是正確的。您可以使用'http:// localhost:9200/technogym1/technogym_type1/_mapping?pretty = true'驗證映射 – prayagupd