1、索引的创建和查询
curl -H "Content-Type:application/json;charset=utf-8" -XPUT 'http://localhost:9200/student_info'
curl -H "Content-Type:application/json;charset=utf-8" -XPOST 'http://localhost:9200/student_info/_search?pretty'
2、索引的mapping导入和查询
curl -H "Content-Type:application/json;charset=utf-8" -XPUT 'http://localhost:9200/student_info/doc/_mapping?' -d '{"doc":{"date_detection":false,"properties":{"name":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"age":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"mobile_phone":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}}}}'
curl -H "Content-Type:application/json;charset=utf-8" -XGET 'http://localhost:9200/student_info/_mapping?'
3、索引的删除
curl -H "Content-Type:application/json;charset=utf-8" -XDELETE 'http://localhost:9200/student_info?'
4、文档的插入
curl -H "Content-Type:application/json;charset=utf-8" -XPOST 'http://localhost:9200/student_info/doc?' -d '{ "name" : "张三", "age" : "21岁", "mobile_phone" : "1724563120"} '
5、文档的查询
curl -H "Content-Type:application/json;charset=utf-8" -XPOST 'http://localhost:9200/student_info/_search?pretty' -d '{"query":{"term" : {"mobile_phone":"1724563120"}}}'
6、文档的删除
curl -H "Content-Type:application/json;charset=utf-8" -XDELETE 'http://localhost:9200/student_info/doc/_id?'
网友评论