gpt4 book ai didi

elasticsearch - 验证数据库是否已由Elasticsearch索引

转载 作者:行者123 更新时间:2023-12-02 23:41:17 25 4
gpt4 key购买 nike

我正在使用Elasticsearch索引和搜索我的数据库...

  • 如何验证数据库已建立索引?
  • 如果我使用以下命令:

    curl -XGET'http://localhost:9200/_search?q=whatever'

  • 结果是:
    {
    "took": 4,
    "timed_out": false,
    "_shards": {
    "total": 6,
    "successful": 6,
    "failed": 0
    },
    "hits": {
    "total": 0,
    "max_score": null,
    "hits": []
    }
    }

    这些结果应如何解释?

    最佳答案

    您可以使用以下命令获取数据库中存在的索引列表。您可以查看列表中是否存在您的索引。这表明索引已创建。

    curl -XGET 'localhost:9200/_cat/indices?v&pretty'

    检查索引中是否存在任何条目。您可以使用此命令获取所有文档的列表。
    curl -XGET 'localhost:9200/INDEX_NAME/_search?v&pretty'

    在您发布的问题中。
    “_shards” {
    “total”:给出索引中存在多少个条目(此处为6)
    }
    “点击数”:{
    “total”:为您提供与您的搜索相匹配的条目,无论关键字如何(此处为0)
    }

    关于elasticsearch - 验证数据库是否已由Elasticsearch索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17424937/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com