我是ES新手,嘗試使用java apis進行搜索。我無法弄清楚如何使用java apis提供特定的提升。 這裏是例子: 我的索引文件是這樣的:ElasticSearch使用java api進行字段提升
_source「:{
"th_id": 1,
"th_name": "test name",
"th_description": "test desc",
"th_image": "test-img",
"th_slug": "Make-Me-Smart",
"th_show_title": "Coast Tech Podcast",
"th_sh_category": "Alternative Health
}
當我搜索的關鍵詞我想提高的結果更高,如果他們在發現「th_name」相比,他們在其他一些領域發現。 目前我使用下面的代碼進行搜索:
QueryBuilder qb1 = QueryBuilders.multiMatchQuery(keyword, "th_name", "th_description", "th_show_title", "th_sh_category");
SearchResponse response = client.prepareSearch("talk").setTypes("themes")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(qb1)
.setFrom(start).setSize(maxRows)
.setExplain(true).execute().actionGet();
如果在「th_name」字段中找到與在其他字段中找到的關鍵字相關的關鍵字,那麼在查詢時我可以做些什麼來增強文檔?
這是完美的。感謝您提供Java版本。 – apatel 2013-03-16 20:39:34