zoukankan      html  css  js  c++  java
  • ElasticSearch(二十)定位不合法的搜索及其原因

    GET /test_index/test_type/_validate/query?explain
    {
      "query": {
        "math": {
          "test_field": "test"
        }
      }
    }

    这边math拼写错误,相对应的返回:

    {
      "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去验证一下,搜索是否合法

  • 相关阅读:
    UVA 10066 The Twin Towers
    UVA 10192 Vacation
    hdu 5018 Revenge of Fibonacci
    hdu 5108 Alexandra and Prime Numbers
    UVA 10252
    UVA 10405最长公共子序列
    数塔
    hdu 2602
    面向对象(五)
    面向对象(三)
  • 原文地址:https://www.cnblogs.com/ql211lin/p/10890483.html
Copyright © 2011-2022 走看看