kkewwei opened a new issue, #14028:
URL: https://github.com/apache/lucene/issues/14028
### Description
In my use-case, I discover the utilization percentage of `QueryCache`(with a
capacity of 3GB and only 50MB used) is extremely low. Most of the queries are
as follows:
```
POST index1/_search
{
"size": 300,
"query": {
"bool": {
"filter": [
{
"terms": {
"user_type": [0, 1, 3, 5, 4, 6]
}
}
],
"should": [
{
"match": {
"name_ik": {
"query": "ab cd ed gh",
"operator": "OR",
"analyzer": "ik_max_word",
}
}
}
],
"minimum_should_match": "2<90%",
}
}
}
```
- `should-match` condition will match over 500 documents, and the query
value keeps changing, due to the `should `clause, it won't be cached by
`QueryCache`.
- `filter-terms` will match over 100,000,000 documents, the `user_type` has
several fixed values, it will also not be cached because of the
`skipCacheFactor`(100,000,000 / skipCacheFactor > 500).
https://github.com/apache/lucene/blob/067b472a320077b73597743aad33977b8400c22a/lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java#L773
There seem to be several points for optimization:
- When the utilization percentage of `QueryCache` is not full utilized, can
we loosen the restrictions to cache more queries that don't meet the current
conditions?
- User could be allowed to dynamically modify the `skip_factor` of
`QueryCache`. Alternatively, this parameter could be deprecated, If a query
meets `minFrequencyToCache`, meaning it is frequent, it should be placed into
`QueryCache`.
Furthermore, if user were able to dynamically adjust `maxSize`,
`maxRamBytesUsed` in `QueryCache`, considering that the overhead of such
adjustments is rather small.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]