0
我試圖理解並通過與彈性搜索PyES的一些示例用法來上班的時候,我發現在對象類型這個片段:http://packages.python.org/pyes/guide/reference/mapping/object-type.htmlPyes:對象類型的選擇性分配到JSON
在這個例子中JSON:
{
"tweet" : {
"person" : {
"name" : {
"first_name" : "Shay",
"last_name" : "Banon"
},
"sid" : "12345"
},
"message" : "This is a tweet!"
}
}
「tweet」,「person」和「name」都是dicitonaries。 爲什麼在他的榜樣對象類型的映射,他不加"type": "object"
到"name"
或"tweet"
字典,如下圖所示:
{
"tweet" : {
"properties" : {
"person" : {
"type" : "object",
"properties" : {
"name" : {
"properties" : {
"first_name" : {"type" : "string"},
"last_name" : {"type" : "string"}
}
},
"sid" : {"type" : "string", "index" : "not_analyzed"}
}
}
"message" : {"type" : "string"}
}
}
}