Index integer type took more time to search, confused


(yaoqijun) #1

this is my index mapping ,
{
"myIndex":{
"mappings":{
"discovery":{
"properties":{
"create_time":{
"type":"long",
"index":false
},
"delete_tag":{
"type":"integer"
},
"desc":{
"type":"text",
"analyzer":"ik_smart"
},
"desc_summary":{
"type":"text",
"analyzer":"ik_smart"
},
"hot_huati_good_ids":{
"type":"keyword"
},
"hot_huati_top_ids":{
"type":"keyword"
},
"name":{
"type":"text",
"analyzer":"ik_smart"
},
"page_id_list":{
"type":"keyword"
},
"is_qualified": {
"type": "integer"
}
}
}
}
}
}

it has is_qualified field. has been indexed,
so i search json is
{
"from":0,
"size":20,
"query":{
"bool":{
"filter":[
{
"bool":{
"should":[
{
"term":{
"page_id_list":{
"value":"5a4384878000862471d147fc",
"boost":1
}
}
},
{
"term":{
"hot_huati_top_ids":{
"value":"5a4384878000862471d147fc",
"boost":1
}
}
},
{
"term":{
"hot_huati_good_ids":{
"value":"5a4384878000862471d147fc",
"boost":1
}
}
}
],
"adjust_pure_negative":true,
"boost":1
}
},
{
"term":{
"delete_tag":{
"value":1,
"boost":1
}
}
}
],
"should":[
{
"match":{
"name":{
"query":"兰蔻",
"boost":20
}
}
},
{
"match":{
"desc_summary":{
"query":"兰蔻",
"boost":10
}
}
},
{
"term":{
"is_qualified":{
"value":1,
"boost":40
}
}
}
],
"adjust_pure_negative":true,
"boost":1
}
},
"_source": false
}

image

it toke 342ms , remove is_qualified boost but if ichange search json with
{
"from":0,
"size":20,
"query":{
"bool":{
"filter":[
{
"bool":{
"should":[
{
"term":{
"page_id_list":{
"value":"5a4384878000862471d147fc",
"boost":1
}
}
},
{
"term":{
"hot_huati_top_ids":{
"value":"5a4384878000862471d147fc",
"boost":1
}
}
},
{
"term":{
"hot_huati_good_ids":{
"value":"5a4384878000862471d147fc",
"boost":1
}
}
}
],
"adjust_pure_negative":true,
"boost":1
}
},
{
"term":{
"delete_tag":{
"value":1,
"boost":1
}
}
}
],
"should":[
{
"match":{
"name":{
"query":"兰蔻",
"boost":20
}
}
},
{
"match":{
"desc_summary":{
"query":"兰蔻",
"boost":10
}
}
}
],
"adjust_pure_negative":true,
"boost":1
}
},
"_source": false
}

image

took time save a lot , so the reason is ? should i change the is_qualified filed type to keyword??