elasticsearch学习总结,转自易百教程https://www.yiibai.com
1、使用postman像elasticsearch添加数据
url------http://localhost:9200/test/movie/1
body-------{ "title": "The Godfather", "director": "Francis Ford Coppola", "year": 1972 }
2、使用postman查询elasticsearch里面的数据
url------http://localhost:9200/_search
body-------{ "query": { "query_string": { "query": "kill" } } }
{ "query": { "filtered": { "query": { "query_string": { "query": "drama" } }, "filter": { "term": { "year": 1962 } } } } }
3、查询多个索引使用方法
url------http://localhost:9200/schools,movies/_search
body-------{ "query": { "query_string": { "query": "kill" } } }
4、查询所有的索引的方法,
http://localhost:9200/_all/_search
5、多类型多索引的查询方法:
/_search
在所有的索引中搜索所有的类型
/gb/_search
在 gb
索引中搜索所有的类型
/gb,us/_search
在 gb
和 us
索引中搜索所有的文档
/g*,u*/_search
在任何以 g
或者 u
开头的索引中搜索所有的类型
/gb/user/_search
在 gb
索引中搜索 user
类型
/gb,us/user,tweet/_search
在 gb
和 us
索引中搜索 user
和 tweet
类型
/_all/user,tweet/_search
在所有的索引中搜索 user
和 tweet
类型