弹性搜索大小无限 [英] Elastic Search size to unlimited
问题描述
{
size:total no of record//这里我需要获取总收藏记录
query:{
match:{
first_name:vineeth
}
}
}
通过运行此查询,我只得到最多10条记录,我确定有超过我的收藏中有10个匹配的记录。我搜索了很多,最后在查询中得到了size参数。但在我的情况下,我不知道记录的总计数。我认为给一个无限数量的大小变量不是一个好的做法,所以如何管理这种情况请帮我解决这个问题,谢谢
显示所有结果并不常见,而是使用和 size
中的指定范围的结果获取。因此,您的查询(用于获取前10个结果)应如下所示:
{
from: 0,
size:10,
query:{
match:{
first_name:vineeth
}
}
}
这应该比设置 size
到一个非常大的价值。要检查与您的查询匹配的文档数量,您可以从响应中获取
hits.total
(总点击数)。
Am new to elastic search. Am facing a problem to write a search query returning all matched records in my collection. Following is my query to search record
{
"size":"total no of record" // Here i need to get total no of records in collection
"query": {
"match": {
"first_name": "vineeth"
}
}
}
By running this query i am only getting maximum 10 records, am sure there is more than 10 matching records in my collection. I searched a lot and finally got size parameter in query. But in my case i dont know the total count of records. I think giving an unlimited number to size variable is not a good practice, so how to manage this situation please help me to solve this issue, Thanks
It's not very common to display all results, but rather use from
and size
to specify a range of results to fetch. So your query (for fetching the first 10 results) should look something like this:
{
"from": 0,
"size": 10,
"query": {
"match": {
"first_name": "vineeth"
}
}
}
This should work better than setting size
to a ridiculously large value. To check how many documents matched your query you can get the hits.total
(total number of hits) from the response.
这篇关于弹性搜索大小无限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!