Using constant multi_match query as filter


(Nathan Gass) #1

Hi

I implemented a filter for adult pages in a web search using a multi_match query like the following:
{
"multi_match": {
"fields": [
"content",
"meta.description",
"meta.keywords"
],
"type": "cross_fields",
"query": "long nsfw word list",
"minimum_should_match": 6,
"operator": "or",
"boost": 0
}
}

I was hoping that this would be cacheable as the adult query never changes.
But currently it seems to have some overhead on queries (an intern query with 0 results is 10 ms without adult filter and 40 ms with adult filter, a normal user search with ca 500000 results is 100ms without and 250 with).

Can I somehow force elasticsearch to cache the results of this query?
Any other ideas on how to construct an adult filter with less overhead?

I can of course just calculate an adult flag at index time, which is the current plan but a lot less flexible than a cached query would be.

We currently use elasticsearch 2.4.1

Greetings
Nathan Gass


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.