Will Elasticsearch remove exist filter cache after I set cache in query to false

Say I have a filter in query like this:

{
    "query" : {
        "filtered" : { 
            "filter" : {
                "term" : { 
                    "price" : 20
                }
            }
        }
    }
}

According to the official doc, there will be a filter cache associated to the key "price". One day, I change the query as follow:

{
    "query" : {
        "filtered" : { 
            "filter" : {
                "term" : { 
                    "price" : 20,
                    "_cache" : false
                }
            }
        }
    }
}

Will Elasticsearch automatically remove the exist cache?

Upvotes: 0

Views: 1040

Answers (1)

pythonHelpRequired
pythonHelpRequired

Reputation: 649

Not really sure. It will probably be removed eventually but probably not immediately. It doesn't really matter however as setting _cache = false will tell elastic search to not use the cache even if it is technically still there. If you want to clear the cache manually there's an API for it.

Here is an example:curl -XPOST 'http://localhost:9200/twitter/_cache/clear

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-clearcache.html

Upvotes: 1

Related Questions