本文主要是介绍Elasticsearch学习笔记-第51节:初识搜索引擎_上机动手实战如何定位不合法的搜索以及其原因,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
课程大纲
GET /test_index/test_type/_validate/query?explain
{
"query": {
"math": {
"test_field": "test"
}
}
}
{
"valid": false,
"error": "org.elasticsearch.common.ParsingException: no [query] registered for [math]"
}
GET /test_index/test_type/_validate/query?explain
{
"query": {
"match": {
"test_field": "test"
}
}
}
{
"valid": true,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"explanations": [
{
"index": "test_index",
"valid": true,
"explanation": "+test_field:test #(#_type:test_type)"
}
]
}
一般用在那种特别复杂庞大的搜索下,比如你一下子写了上百行的搜索,这个时候可以先用validate api去验证一下,搜索是否合法
这篇关于Elasticsearch学习笔记-第51节:初识搜索引擎_上机动手实战如何定位不合法的搜索以及其原因的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!