简体   繁体   English

如何在Elasticsearch中检索所有文档

[英]How to retrieve all documents in elasticsearch

I am a novice in ES and need help. 我是ES的新手,需要帮助。

Here is my data set from JSON 这是我来自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"]
            }
        ]
    }
}

question is that I used the below command to index: curl -XPOST locahost:9200/myindex/wiki --data-binary @wiki.json 问题是我使用以下命令编制了索引:curl -XPOST locahost:9200 / myindex / wiki --data-binary @ wiki.json

After execution: (52) Empty reply from server and total 2 successful 1 and failed 0. When I use command : curl -XGET localhost:92200/myindex/wiki/1?pretty? 执行后:(52)来自服务器的空答复,总计2成功1,失败0。当我使用命令时:curl -XGET localhost:92200 / myindex / wiki / 1?漂亮吗?

I get the below but not all the details and found is false. 我得到以下内容,但不是全部细节,但发现是错误的。

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

How do I ensure found is true and the whole title and abstract are retrieved. 我如何确保找到的是真实的,并且检索了整个标题和摘要。 Any help is much appreciated. 任何帮助深表感谢。

Could you attach your received message after posting data? 发布数据后,您可以附加收到的消息吗? (I cannot add a comment now) (我现在无法添加评论)

You can read this and try again. 您可以阅读并重试。

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

相关问题 如何在elasticsearch中删除多个文档? - How to delete multiple documents in elasticsearch? 在文件Elasticsearch 1.7中获取索引的所有文档 - Get all documents of the index in a file Elasticsearch 1.7 检索所有 mongoDB 文档并存储在列表中 - Retrieve all mongoDB documents and store in a List MongoDb:检索所有高于某列平均值的文档 - MongoDb: Retrieve all documents higher than the average value of a column 使用 Elasticsearch 检索给定日期不在两个日期类型字段之间的文档 - Retrieve documents where a given date is not between two fields of type Date with Elasticsearch 如何查询所有文档中所有不同的嵌入文档 - How to query all distinct embedded documents in all documents 在elasticsearch中插入多个文档 - Insert multiple documents in elasticsearch 如何使用Java手动展平Elasticsearch嵌套JSON文档? - How to manually flatten Elasticsearch nested JSON documents using Java? 如何还使用 Laravel Scout Elasticsearch Driver 从 Elasticsearch 获取文档的自定义字段? - How to also get custom fields of documents from Elasticsearch using Laravel Scout Elasticsearch Driver? Elasticsearch查询以选择包含一个字段的值的所有文档多值字段 - Elasticsearch query to select all documents where one field's value is contained multi-valued field
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM