gpt4 book ai didi

elasticsearch - 使用日期间隔进行范围查询

转载 作者:行者123 更新时间:2023-12-03 01:59:26 24 4
gpt4 key购买 nike

有一个时间戳记为2015-05-18T19:08:35Z的文档。在下面的查询中正确返回此值。
但是,如果我将时间间隔从5分钟增加到10分钟,则结果中不会显示同一行。

curl -XGET "http://localhost:9200/enwiki_content/page/_search?&pretty=true" -d' {
"query": {
"range": {
"timestamp": {
"gte": "2015-05-18T19:04:00Z",
"lte": "2015-05-18T19:09:00Z"
}
}
} } ' > out2.txt



curl -XGET "http://localhost:9200/enwiki_content/page/_search?&pretty=true" -d' {
"query": {
"range": {
"timestamp": {
"gte": "2015-05-18T19:01:00Z",
"lte": "2015-05-18T19:09:00Z"
}
}
} } ' > out2.txt

上面的第二个查询应返回第一个查询的所有行以及任何其他匹配的行。对?
(如果重要的话,这是Wikipedia 500万数据(超过100 GB)。)

最佳答案

原因是因为第二个查询可能返回更多结果,而您只得到前10个(默认情况下)。

尝试增加第二个查询的大小,您应该得到预期的记录。

curl -XGET "http://localhost:9200/enwiki_content/page/_search?&pretty=true" -d' {
"size": 100, <--- add this line
"query": {
"range": {
"timestamp": {
"gte": "2015-05-18T19:01:00z",
"lte": "2015-05-18T19:09:00z"
}
}
} } ' > out2.txt

要么
                                                             add size
|
V
curl -XGET "http://localhost:9200/enwiki_content/page/_search?size=100&pretty=true" -d' {
"query": {
"range": {
"timestamp": {
"gte": "2015-05-18T19:01:00z",
"lte": "2015-05-18T19:09:00z"
}
}
} } ' > out2.txt

关于elasticsearch - 使用日期间隔进行范围查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34059614/

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