es查询总数
POST qa_question_test/_doc/_search
{
"track_total_hits":true,
"query": {
"bool": {
"must": [
{
"term": {
"qaTagSort": "90"
}
}
]
}
}
}
查询总数超过1w条,需要添加"track_total_hits":true 再查看hits.total
java代码需要在query上添加如下
// 搜索,获取结果
searchQuery.setTrackTotalHits(true);
es添加字段
PUT qa_append_pro/_mapping
{
"properties": {
"usefulNumber": {"type": "keyword"}
}
}