简体   繁体   English

弹性搜索无法获取python代码中的所有文档

[英]Elastic search not get the all of documents in python code

I have elastic search single node cluster and it has some index.The index contain 6000 or more documents.Document mapping has lot of fields like(30 or more).I can query all of duplicate records in (Kibana dev tool) but i am querying with python result like 10 records or 20 records.What is the reason? 我有弹性搜索单节点集群,并且有一些索引。该索引包含6000或更多文档。文档映射具有很多字段,例如(30或更多)。我可以在(Kibana dev tool)中查询所有重复记录,但是我是用python结果查询10条记录或20条记录。原因是什么?

my index and document count 我的索引和文件数

yellow open   test_index kjioInpQRAqT3o1LZHI92g   1   2       7652         1267      20.7mb          20.7mb

my mapping 我的地图

{
 "settings": {
  "number_of_shards": 1,
  "number_of_replicas": 2 
 },

 "mappings": {
  "test_index" : {
    "properties": {
        "name": {
            "type": "keyword"
        },
        "address": {
            "type": "keyword"
        },
        # MORE 35 FIELDS ....
        }
      }
   }
}

I found the reason.Document has lot of fields.It has 35 fields.I can query in (kibana dev) tool.Query returned 1000 documents for one time.Python elastic search library can't get this count of documents reason is the single document is too large (Document has 35 fields).Then i change the query and i put the useful fields for query result.Now it's work file. 我找到原因了,文档有很多字段,有35个字段,我可以在(kibana dev)工具中查询,一次查询返回了1000个文档,Python弹性搜索库无法获得此文档数原因是单文档太大(文档有35个字段)。然后我更改了查询,并将有用的字段用于查询结果。现在它是工作文件。

Change your query like this (normal query) 像这样更改您的查询(普通查询)

`{
   "_source": ["_id","_index", "quote_date", "asset"],
   "query": {
       "match_all": {
       }
   }
}`

Change your query like this (aggregation query) 像这样更改您的查询(聚合查询)

` "aggs": {        
  "duplicateDocuments": {        
     "top_hits": {
        "_source": ["_id","_index", "name", "address"],
                    "sort": [{"create_at": { "order": "desc"} } ]                                                                                                                                
                }
            }
   }`

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

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