hi:
I found that es v2.3.3 [_count] and [_search] both support [post_filter]
but es v5.0.2 [_count] does not support [post_filter].
I also found es v5.4.2 has the same problem.
Is that a BUG?
hi:
I found that es v2.3.3 [_count] and [_search] both support [post_filter]
but es v5.0.2 [_count] does not support [post_filter].
I also found es v5.4.2 has the same problem.
Is that a BUG?
_count has been removed in 5.0. Search for breaking changes in the guide.
wow, I doesn't found some other way to replace "[_count] with [post_filter]" in new es.
I think the "[_count] with [post_filter]" is useful, and I suggest es can give this fature
look at this:
/_count -d '{"query":{...}, "post_filter":{"range":{...}}}'
I just want the count, But now, I have to use _search to get the count.
thank you for answer
Please format your code using </>
icon as explained in this guide. It will make your post more readable.
Or use markdown style like:
```
CODE
```
I just want the count, But now, I have to use _search to get the count.
Hmm. Sounds like I was wrong. _count
API still exists: Count API | Elasticsearch Reference [5.4] | Elastic
What has been removed is search_type=count
: Search and Query DSL changes | Elasticsearch Reference [5.4] | Elastic
I think it's perfectly to call _search
with size: 0
. It will behave like a count actually.
I have a dsl like this:
{
"query":{
"query_string":{
"query":"request_uri:"/*.html""
}
},
"post_filter":{
"range":{
"@timestamp_date":{
"gte":"2017-07-05 09:07:00",
"lt":"2017-07-05 09:08:00",
"format":"yyyy-MM-dd HH:mm:ss"
}
}
}
}
when es v2.3.3, you can use this on [_count] and [_search]
but you can not use this on [_count] when es v5.0.2 and es v5.4.2 (maybe all es v5.0+)
But you can run this right?
GET _search
{
"size": 0,
"query":{
"query_string":{
"query":"request_uri:"/*.html""
}
},
"post_filter":{
"range":{
"@timestamp_date":{
"gte":"2017-07-05 09:07:00",
"lt":"2017-07-05 09:08:00",
"format":"yyyy-MM-dd HH:mm:ss"
}
}
}
}
I opened actually:
Because I believe we should not support 2 APIs to do the same thing with one of the APIs which does not support everything that the other one supports.
Thank you very much for your answer.
Yes, I can run it by set "size to 0".
I have an env like that : I should get the count first, and then I set this count to size for search api.
I have an env like that : I should get the count first, and then I set this count to size for search api.
That sounds a bad idea to me.
To you mean that you want to display on a single page 1000000 documents if you have 1m matching docs?
I search about 15k doc every min. but not for display, for calculate.
Why counting then? If the page size is 15000, set it to 15000. You need to change some index settings though to allow more than 10000. Or use scroll API.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.