Elasticsearch CustomQueryBuilder slowly


(awnuxkjy) #1

I used CustomQueryBuilder cost 634ms. for example:

[2013-12-04 11:49:12,300][TRACE][index.search.slowlog.query] [h35] [cms][1] took[634ms], took_millis[634], types[news], stats[], search_type[QUERY_THEN_FETCH], total_shards[10], source[{"from":0,"size":10,"query":{"custom_score":{"query":{"filtered":{"query":{"query_string":{"query":"大连机场","fields":["title","content"],"analyzer":"ik"}},"filter":{"bool":{"must":{"range":{"updatetime":{"from":1354591800,"to":1386127800,"include_lower":true,"include_upper":true}}}}}}},"script":"int day=doc['updatetime'].value/86400;if (day < currentDay) {int delta=(currentDay-day)/5+1;if(delta<32){_score=_score+6pow(0.9,delta);}else{_score=_score+3pow(0.9,31);}} else if (day > currentDay) {_score=_score+3*pow(0.9,31);} else{_score=_score+3;}","params":{"currentDay":16043}}},"fields":["id","channelid","catid","model","title","content","thumb","url","updatetime"],"sort":[{"_score":{"order":"desc"}},{"updatetime":{"order":"desc"}}],"highlight":{"pre_tags":[""],"post_tags":[""],"encoder":"UTF-8","fields":{"title":{},"content":{"fragment_size":72,"number_of_fragments":3}}}}], extra_source[],

I dont used CustomQueryBuilder,query very fast。

What is the reason? thanks!


(system) #2