我正在從betfair api-ng獲取marketcatalogue數據,我想將它存儲到elasticsearch(v1.4.4)中。爲來自遠程api的字典定義elasticsearch映射
來自API的數據包含很多屬性和複雜類型。有一個名爲的跑步者其中包含相關數據和Dictionary<string,string>
。我想定義這樣的映射,所以它將數據存儲在Elasticsearch中。樣本映射下面是:
"marketcatalogue" :{
"properties":{
"marketId":{"type":"string", "index": "not_analyzed" },
"marketName":{"type":"string", "analyzer":"keylower" },
"isMarketDataDelayed":{"type","boolean"},
"description":{
"persistenceEnabled":{"type","boolean"},
"bspMarket":{"type","boolean"},
"marketTime":{"type" : "date","format":"dateOptionalTime"},
"suspendTime":{"type" : "date","format":"dateOptionalTime"},
"settleTime":{"type" : "date","format":"dateOptionalTime"},
"bettingType":{"type":"integer"},
"turnInPlayEnabled":{"type","boolean"},
"marketType":{"type":"string", "analyzer":"keylower" },
"regulator":{"type":"string", "analyzer":"keylower" },
"marketBaseRate":{"type":"double"},
"discountAllowed":{"type","boolean"},
"wallet":{"type":"string", "analyzer":"keylower"},
"rules":{"type":"string"},
"rulesHasDate":{"type","boolean"},
"clarifications":{"type":"string"}
},
"runners":{
"selectionId":{"type":"long"},
"runnerName":{"type":"string", "analyzer":"keylower"},
"handicap":{"type":"double"},
"metadata":{
}
}
}
}
}
的medatadata是Dictionary<string,string>
從API來和它可以包含像數據:
<"TRAINER_NAME", "John">, <"WEARING", "Wearing one">,....
將數據存儲到類型是不是一個大問題,但問題是如何定義字典的映射。
任何幫助將節省我很多時間,並會讓我學習映射創作更好的方法。
在此先感謝。
你的建議奏效。非常感謝 –