es - elasticsearch mapping - meta fields - 7
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了es - elasticsearch mapping - meta fields - 7,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1200字,纯文字阅读大概需要2分钟。
内容图文
![es - elasticsearch mapping - meta fields - 7](/upload/InfoBanner/zyjiaocheng/1004/5bcb164f99124fb98728e2e939f992ad.jpg)
世界上并没有完美的程序,但是我们并不因此而沮丧,因为写程序就是一个不断追求完美的过程。
问 :_routing有什么特点?
答 :
问 :_routing如何使用?
答 :
# _routing
PUT /routing_test
{
"mappings" : {
"_routing" : {
"required" : true
},
"properties" : {
"name" : {"type" : "text"}
}
}
}
# 索引
POST /routing_test/_doc/1?routing=hello
{
"name" : "hello good"
}
# 索引,当_routing设置为required=true时,没有routing则报错
POST /routing_test/_doc/2
{
"name" : "tea"
}
# 结果
{
"error" : {
"root_cause" : [
{
"type" : "routing_missing_exception",
"reason" : "routing is required for [routing_test]/[_doc]/[2]",
"index_uuid" : "_na_",
"index" : "routing_test"
}
],
"type" : "routing_missing_exception",
"reason" : "routing is required for [routing_test]/[_doc]/[2]",
"index_uuid" : "_na_",
"index" : "routing_test"
},
"status" : 400
}
# 搜索
GET /routing_test/_search
{
"query" : {
"terms" : {
"_routing" : ["hello"]
}
}
}
# 结果
{
"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" : "routing_test",
"_type" : "_doc",
"_id" : "1",
"_score" : 1.0,
"_routing" : "hello",
"_source" : {
"name" : "hello good"
}
}
]
}
}
内容总结
以上是互联网集市为您收集整理的es - elasticsearch mapping - meta fields - 7全部内容,希望文章能够帮你解决es - elasticsearch mapping - meta fields - 7所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。
来源:【匿名】