我在弹性搜索方面遇到了一些麻烦。
目前:
我的机器规格如下
CPU缓存:15kb
VM名称:Java HotSpot(TM)64位服务器VM
elasticsearch v / 1.3.2
我的索引(metadatav3)包含:
{
"metadatav3": {
"mappings": {
"track": {
"dynamic": "true",
"numeric_detection": true,
"properties": {
"album.album": {
"type": "string",
"norms": {
"enabled": false
},
"analyzer": "music_field"
},
"album.exact": {
"type": "string",
"analyzer": "exact_music_field"
},
"artist.artist": {
"type": "string",
"norms": {
"enabled": false
},
"analyzer": "music_field"
},
"artist.exact": {
"type": "string",
"analyzer": "exact_music_field"
},
"fullString": {
"type": "string",
"norms": {
"enabled": false
},
"analyzer": "nGram_token_field"
},
"fullString.token": {
"type": "string",
"norms": {
"enabled": false
},
"analyzer": "music_field"
},
"id": {
"type": "string"
},
"isHidden": {
"type": "boolean"
},
"lastRankedDate": {
"type": "long"
},
"popularity": {
"type": "float"
},
"tagCount": {
"type": "long"
},
"title.edgeNGNoSplit": {
"type": "string",
"norms": {
"enabled": false
},
"analyzer": "edge_nGram_no_split_small_field"
},
"title.exact": {
"type": "string",
"analyzer": "exact_music_field"
},
"title.title": {
"type": "string",
"norms": {
"enabled": false
},
"analyzer": "music_field"
}
}
}
}
}
}
当我运行该查询时:
{
"from": 0,
"size": 20,
"timeout": 5000,
"query": {
"function_score": {
"query": {
"bool": {
"must": {
"match": {
"fullString": {
"query": "test",
"type": "boolean",
"operator": "OR",
"minimum_should_match": "1",
"cutoff_frequency": 0.01
}
}
},
"must_not": {
"term": {
"isHidden": "true"
}
},
"should": []
}
},
"field_value_factor": {
"field": "popularity"
}
}
},
"explain": false
}
接近50-60 req / sec的搜索响应时间变为60ms到4-5秒。
但是,当我运行该查询时:
{
"from": 0,
"size": 20,
"timeout": 5000,
"query": {
"function_score": {
"query": {
"bool": {
"must": {
"match": {
"fullString.token": {
"query": "test",
"type": "boolean",
"operator": "OR",
"minimum_should_match": "1",
"cutoff_frequency": 0.01
}
}
},
"must_not": {
"term": {
"isHidden": "true"
}
},
"should": []
}
},
"field_value_factor": {
"field": "popularity"
}
}
},
"explain": false
}
在负载测试期间我可以看到600 req / sec。
我的意思是我不明白使用ngram过滤器的部分可以创建那么多的cpu用法吗?
热线程转储如下:http://pastebin.com/5sFEZJa5 我也可以发送/上传bigdesk截图。
感谢。