在ElasticSearch中搜索固定数值

如果我想要somefield为12345的文档,则可以执行"query": { "term" : {"somefield" : {"value": 12345 }}}"query": {"match" : {"somefield": 12345 }}。哪个更快?

wearcoll658 回答:在ElasticSearch中搜索固定数值

仅当您将std::map<std::string,int> answers; int count_answers( const std::string &question) { auto &value = answers.insert( {question,42}).first->second; return ++value; } int main() { std::cout << count_answers( "Life,the universe and everything") << '\n'; std::cout << count_answers( "Life,the universe and everything") << '\n'; return 0; } 查询为try_emplaceterm类型之一并将其索引比keyword更快时,才能使用numeric查询。最快的将是match查询。它不会影响文档评分。

filter
本文链接:https://www.f2er.com/3167653.html

大家都在问