11 May 2020

Query vs Filter [elasticsearch]

Filter is more cheap than Query!

Query involve scoring.... expensive
Filter


Query:
GET /_search
{
"query": {
"term": {
"": {
"value": ""
}
}
}
}
expensive.



wrapped with filter to speed up things:
GET /_search
{
"query": {
"constant_score" : {
"filter" : {
"term" : {"" : ""}
}
}
}
}



ref:  https://towardsdatascience.com/deep-dive-into-querying-elasticsearch-filter-vs-query-full-text-search-b861b06bd4c0

No comments:

Post a Comment

Terima kasih