繁体   English   中英

如何在Elasticsearch中检索所有文档

[英]How to retrieve all documents in elasticsearch

我是ES的新手,需要帮助。

这是我来自JSON的数据集

{
    "simplewiki": {
        "page": [{
                "index": {
                    "_index": "myindex",
                    "_type": "wiki",
                    "_id": "1"
                }
            },
            {
                "title": "April",
                "url": "https://simple.wikipedia.org/wiki/April",
                "abstract": "April is the 4th month of the year, and comes between March and May. It is one of four months to have 30 days.",
                "sections": ["The Month", "April in poetry", "Events in April", "Fixed Events", "Moveable Events", "Selection of Historical Events", "Trivia", "References"]
            },

            {
                "index": {
                    "_index": "myindex",
                    "_type": "wiki",
                    "_id": "2"
                }
            },
            {
                "title": "August",
                "url": "https://simple.wikipedia.org/wiki/August",
                "abstract": "August (Aug.) is the 8th month of the year in the Gregorian calendar, coming between July and September.",
                "sections": ["The Month", "August observances", "Fixed observances and events", "Moveable and Monthlong events", "Selection of Historical Events", "Trivia", "References"]
            }
        ]
    }
}

问题是我使用以下命令编制了索引:curl -XPOST locahost:9200 / myindex / wiki --data-binary @ wiki.json

执行后:(52)来自服务器的空答复,总计2成功1,失败0。当我使用命令时:curl -XGET localhost:92200 / myindex / wiki / 1?漂亮吗?

我得到以下内容,但不是全部细节,但发现是错误的。

{
  "_index":"myindex",
  "_type":"wiki",
  "_id":"1",
  "found" :false
}

我如何确保找到的是真实的,并且检索了整个标题和摘要。 任何帮助深表感谢。

发布数据后,您可以附加收到的消息吗? (我现在无法添加评论)

您可以阅读并重试。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM