Tuning my filter cache query


(Srinivasan Ramaswamy) #1

I want to make sure I have my filter cache query.

my schema looks like

product: {
	"properties": {
		"productId" : { "type": "long" }
		 //bunch of other properties
		 "offers": {
                "type": "nested",
                "properties": {
                	"offerId": {
                        "type": "long"
                    },
                    "categoryId": {
                        "type": "integer"
                    }
                 //bunch of other properties
                }
         }
	}
}

I am looking for some help in tuning the below query. We have a heap size of 16G and I have set 40% to filter cache, but still we are seeing 10 evictions per sec. I am unable to view the contents of filter cache (is there a way to do that?) Given that I want to make sure my query is optimal. If someone can help me validate my query it would be helpful.

{
"query":{
"function_score":{
"query":{
"filtered":{
"query":{
"multi_match":{
"query":"bed",
"fields":[
"title",
"editorialTitle"
],
"type":"most_fields",
"minimum_should_match":"3<75%"
}
},
"filter":{
"bool":{
"must":[
{
"nested":{
"filter":{
"terms":{
"offers.categoryId":[ 0,1,2,3,4,5,6,7,8,17,23,32,37,38,42,45,49,50,51,52,65,74,75,77,78,86,89,90,96,100 ]
}
},
"path":"products",
"_cache":true
}
},
{
"bool":{
"must_not":{
"fquery":{
"query":{
"multi_match":{
"query":"some adult terms",
"fields":[
"title",
"editorialTitle"
]
}
},
"_cache":false
}
},
"_cache":true,
"_cache_key":"notAdult"
}
}
]
}
}
}
},
"functions":[
{
"script_score":{
"script":"custom-scorer",
"lang":"native",
"params":{
"categoryIds":[ 0,1,2,3,4,5,6,7,8,17,23,32,37,38,42,45,49,50,51,52,65,74,75,77,78,86,89,90,96,100 ],
"query":"bed"
}
}
}
],
"boost_mode":"multiply"
}
},
"explain":false,
"sort":[
{
"_score":{
}
},
{
"productId":{
"order":"desc"
}
}
]
}

Note: we have category Ids that goes up to 3500 and we get different combination (but not too many unique ones) at times.


(system) #2