Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Search | Email

第 24 章 Elasticsearch API

目錄

24.1. Client
24.2. insert
24.3. Get
24.4. delete
24.5. Search
24.6. Query 查詢
24.6.1. match all 匹配所有數據
24.6.2. match 匹配查詢
24.6.3. match phrase 短語精準匹配
24.7. Filter 過濾
24.7.1. term
24.7.2. range
24.8. Sorting
24.9. 返回 Source 欄位
24.10. Count
24.11. Example 範例
24.11.1. Spring boot 案例
24.12. FAQ
24.12.1. 顯示查詢 JSON 字元串

24.1. Client

		
Settings settings = Settings.builder()
					.put("cluster.name", "elasticsearch") //集群名稱
					.put("client.transport.sniff", true) //自動嗅探
					.put("discovery.type", "zen")
					.put("discovery.zen.minimum_master_nodes", 1)
					.put("discovery.zen.ping_timeout", "500ms")
					.put("discovery.initial_state_timeout", "500ms")
					.build();
Client client = new PreBuiltTransportClient(settings)	.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(ip), 9300));