世界上并没有完美的程序,但是我们并不因此而沮丧,因为写程序就是一个不断追求完美的过程。
问 : _field_nams 有什么特点?
答 :
问 :_field_names 如何使用?
答 :
# _field_names
PUT /field_names_test
{
"mappings" : {
"_field_names" : {
"enabled" : true
}
}
}
# 索引
POST /field_names_test/_doc/1
{
"name" : "hello good"
}
# 索引
POST /field_names_test/_doc/2
{
"title" : "hello good"
}
# 查询
GET /field_names_test/_search
{
"query" : {
"exists" : {
"field" : "title"
}
}
}
# 结果
{
"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" : "field_names_test",
"_type" : "_doc",
"_id" : "2",
"_score" : 1.0,
"_source" : {
"title" : "hello good"
}
}
]
}
}