![](/img/trans.png)
[英]Is there a way to get exact location of query match in elastic search documents
[英]Elastic search not get the all of documents in python code
我有彈性搜索單節點集群,並且有一些索引。該索引包含6000或更多文檔。文檔映射具有很多字段,例如(30或更多)。我可以在(Kibana dev tool)中查詢所有重復記錄,但是我是用python結果查詢10條記錄或20條記錄。原因是什么?
我的索引和文件數
yellow open test_index kjioInpQRAqT3o1LZHI92g 1 2 7652 1267 20.7mb 20.7mb
我的地圖
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 2
},
"mappings": {
"test_index" : {
"properties": {
"name": {
"type": "keyword"
},
"address": {
"type": "keyword"
},
# MORE 35 FIELDS ....
}
}
}
}
我找到原因了,文檔有很多字段,有35個字段,我可以在(kibana dev)工具中查詢,一次查詢返回了1000個文檔,Python彈性搜索庫無法獲得此文檔數原因是單文檔太大(文檔有35個字段)。然后我更改了查詢,並將有用的字段用於查詢結果。現在它是工作文件。
像這樣更改您的查詢(普通查詢)
`{
"_source": ["_id","_index", "quote_date", "asset"],
"query": {
"match_all": {
}
}
}`
像這樣更改您的查詢(聚合查詢)
` "aggs": {
"duplicateDocuments": {
"top_hits": {
"_source": ["_id","_index", "name", "address"],
"sort": [{"create_at": { "order": "desc"} } ]
}
}
}`
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.