最近节日
正在加载日历...----
PUT http://localhost:9200/questions

### 创建 indexPUT http://localhost:9200/questions### 删除一个IndexDELETE http://localhost:9200/questions### 设置index中的文档属性采用ik分词POST http://localhost:9200/questions/_mappingContent-Type: application/json
{ "properties": { "title": { "type": "text", "analyzer": "ik_max_word", "search_analyzer": "ik_max_word" }, "content": { "type": "text", "analyzer": "ik_max_word", "search_analyzer": "ik_max_word" } }}### questions 中添加文档POST http://localhost:9200/questions/_create/1Content-Type: application/json
{ "id":1, "title":"Java基本数据类型有哪些", "content":"面时候为啥要问基本类型这么简单问题呀,我们要如何回答呢?"}### questions 中添加文档POST http://localhost:9200/questions/_create/2Content-Type: application/json
{ "id":2, "title":"int类型的范围", "content":"为啥要了解int类型的范围呢?"}### questions 中添加文档POST http://localhost:9200/questions/_create/3Content-Type: application/json
{ "id":3, "title":"常用集合类有哪些", "content":"为啥企业经常问集合呀?该如何回复呢"}### questions 中添加文档POST http://localhost:9200/questions/_create/4Content-Type: application/json
{ "id":4, "title":"线程的run方法和start方法有啥区别", "content":"run方法可以执行线程的计算过程, start也可以执行线程的计算过程,用途一样么?"}### 更新questions索引中的文档POST http://localhost:9200/questions/_doc/4/_updateContent-Type: application/json
{ "doc": { "title": "Java线程的run方法和start方法有啥区别" }}### 删除questions中的一个文档DELETE http://localhost:9200/questions/_doc/2### 查询数据GET http://localhost:9200/questions/_doc/4### 收索 ESPOST http://localhost:9200/questions/_searchContent-Type: application/json
{ "query": { "match": {"title": "类型" } }}### 多字段搜索 should是or,must是andPOST http://localhost:9200/questions/_searchContent-Type: application/json
{ "query": { "bool": { "should": [ { "match": { "title": "java类型" }}, { "match": { "content": "java类型"}} ] } }}