世界上并没有完美的程序,但是我们并不因此而沮丧,因为写程序就是一个不断追求完美的过程。
问 :version有什么特点?
答 :
问 :version如何使用?
答 :
# version
PUT /version_test
{
"mappings" : {
"properties" : {
"my_version" : {"type" : "version"}
}
}
}
# 索引
POST /version_test/_doc
{
"my_version" : "2.3.7"
}
# term搜索
GET /version_test/_search
{
"query" : {
"term" : {
"my_version" : {
"value" : "2.3.7"
}
}
}
}
# range 搜索
GET /version_test/_search
{
"query" : {
"range" : {
"my_version" : {
"gte" : "2.2.7",
"lte" : "2.5.4"
}
}
}
}
# 结果
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "version_test",
"_type" : "_doc",
"_id" : "5WvhHngBnJvha9PMXYwa",
"_score" : 1.0,
"_source" : {
"my_version" : "2.3.7"
}
}
]
}
}