I have a query that looks like this:
{
"query": {
"bool": {
"should": [
{
"match": {
"title": {
"query": "Profound Networks",
"boost": 2
}
}
},
{
"match_phrase": {
"title": {
"query": "Profound Networks",
"boost": 20
}
}
},
{
"match": {
"whois.registrant.country": {
"query": "United States",
"boost": 1
}
}
},
{
"match": {
"whois.admin.country": {
"query": "United States",
"boost": 1
}
}
},
{
"match": {
"tld": {
"query": ".us",
"boost": 10
}
}
}
]
}
}
}
It takes over 30s. How can I speed this up?
While trying to answer the question, I've found that the part that slows it down the most is the country clauses. Removing them gives the query:
{
"query": {
"bool": {
"should": [
{
"match": {
"title": {
"query": "Profound Networks",
"boost": 2
}
}
},
{
"match_phrase": {
"title": {
"query": "Profound Networks",
"boost": 20
}
}
},
{
"match": {
"tld": {
"query": ".us",
"boost": 10
}
}
}
]
}
}
}
and this query takes less than a second. Why do the country match clauses slow the query down so much?
Is there any way I can speed up the original query without removing parts of it?