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 匹配查询
24.6.2. 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));