世界上并没有完美的程序,但是我们并不因此而沮丧,因为写程序就是一个不断追求完美的过程。
问 :rank_features有什么特点?
答 :
问 :rank_features如何使用?
答 :
# rank_features
PUT /rank_features_test
{
"mappings" : {
"properties" : {
"my_rank_features" : {"type" : "rank_features"}
}
}
}
# 索引
POST /rank_features_test/_doc
{
"my_rank_features" : {
"politics" : 10,
"economics" : 20.3
}
}
# 索引
POST /rank_features_test/_doc
{
"my_rank_features" : {
"politics" : 21,
"sports" : 38
}
}
# 搜索
GET /rank_features_test/_search
{
"query" : {
"rank_feature" : {
"field" : "my_rank_features.politics"
}
}
}
# 结果
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 2,
"relation" : "eq"
},
"max_score" : 0.59574467,
"hits" : [
{
"_index" : "rank_features_test",
"_type" : "_doc",
"_id" : "UGeRe3gBVbS9eSDZ1u6Y",
"_score" : 0.59574467,
"_source" : {
"my_rank_features" : {
"politics" : 21,
"sports" : 38
}
}
},
{
"_index" : "rank_features_test",
"_type" : "_doc",
"_id" : "T2eQe3gBVbS9eSDZu-70",
"_score" : 0.41237116,
"_source" : {
"my_rank_features" : {
"politics" : 10,
"economics" : 20.3
}
}
}
]
}
}