Link Search Menu Expand Document Documentation Menu

调试搜索管道

verbose_pipeline 参数提供了搜索请求、搜索响应和搜索阶段处理器在搜索管道中的数据流和转换的详细信息。它有助于故障排除和优化管道,并确保处理搜索请求和响应的透明度。

启用调试

要启用管道调试,请在搜索请求中将 verbose_pipeline=true 指定为查询参数。此功能适用于所有三种搜索管道方法

默认搜索管道

要将 verbose_pipeline 与默认搜索管道一起使用,请在索引设置中将管道设置为默认值,并在查询中包含 verbose_pipeline=true

PUT /my_index/_settings
{
  "index.search.default_pipeline": "my_pipeline"
}

GET /my_index/_search?verbose_pipeline=true

有关默认搜索管道的更多信息,请参阅为索引中的所有请求设置默认管道

特定搜索管道

要将 verbose_pipeline 与特定搜索管道一起使用,请指定管道 ID,并在查询中包含 verbose_pipeline=true

GET /my_index/_search?search_pipeline=my_pipeline&verbose_pipeline=true

有关使用特定搜索管道的更多信息,请参阅为请求指定现有管道

临时搜索管道

要将 verbose_pipeline 与临时搜索管道一起使用,请直接在请求正文中定义管道,并在查询中包含 verbose_pipeline=true

POST /my_index/_search?verbose_pipeline=true
{
  "query": {
    "match": { "text_field": "some search text" }
  },
  "search_pipeline": {
    "request_processors": [
      {
        "filter_query": {
          "query": { "term": { "visibility": "public" } }
        }
      }
    ],
    "response_processors": [
      {
        "collapse": {
          "field": "category"
        }
      }
    ]
  }
}

有关使用临时搜索管道的更多信息,请参阅为请求使用临时管道

示例响应

verbose_pipeline 参数启用时,响应将包含一个额外的 processor_results 字段,该字段提供有关管道中每个处理器应用的转换信息。

响应
{
    "took": 27,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 1,
            "relation": "eq"
        },
        "max_score": 0.18232156,
        "hits": [
            {
                "_index": "my_index",
                "_id": "1",
                "_score": 0.18232156,
                "_source": {
                    "notification": "This is a public message",
                    "visibility": "public"
                }
            }
        ]
    },
    "processor_results": [
        {
            "processor_name": "filter_query",
            "tag": "tag1",
            "duration_millis": 288541,
            "status": "success",
            "input_data": {
                "verbose_pipeline": true,
                "query": {
                    "bool": {
                        "adjust_pure_negative": true,
                        "must": [
                            {
                                "match": {
                                    "message": {
                                        "auto_generate_synonyms_phrase_query": true,
                                        "query": "this",
                                        "zero_terms_query": "NONE",
                                        "fuzzy_transpositions": true,
                                        "boost": 1.0,
                                        "prefix_length": 0,
                                        "operator": "OR",
                                        "lenient": false,
                                        "max_expansions": 50
                                    }
                                }
                            }
                        ],
                        "boost": 1.0
                    }
                }
            },
            "output_data": {
                "verbose_pipeline": true,
                "query": {
                    "bool": {
                        "filter": [
                            {
                                "term": {
                                    "visibility": {
                                        "boost": 1.0,
                                        "value": "public"
                                    }
                                }
                            }
                        ],
                        "adjust_pure_negative": true,
                        "must": [
                            {
                                "bool": {
                                    "adjust_pure_negative": true,
                                    "must": [
                                        {
                                            "match": {
                                                "message": {
                                                    "auto_generate_synonyms_phrase_query": true,
                                                    "query": "this",
                                                    "zero_terms_query": "NONE",
                                                    "fuzzy_transpositions": true,
                                                    "boost": 1.0,
                                                    "prefix_length": 0,
                                                    "operator": "OR",
                                                    "lenient": false,
                                                    "max_expansions": 50
                                                }
                                            }
                                        }
                                    ],
                                    "boost": 1.0
                                }
                            }
                        ],
                        "boost": 1.0
                    }
                }
            }
        },
        {
            "processor_name": "rename_field",
            "duration_millis": 250042,
            "status": "success",
            "input_data": [
                {
                    "_index": "my_index",
                    "_id": "1",
                    "_score": 0.18232156,
                    "_source": {
                        "message": "This is a public message",
                        "visibility": "public"
                    }
                }
            ],
            "output_data": [
                {
                    "_index": "my_index",
                    "_id": "1",
                    "_score": 0.18232156,
                    "_source": {
                        "notification": "This is a public message",
                        "visibility": "public"
                    }
                }
            ]
        }
    ]
}
剩余 350 字符

有问题?

想要贡献?