1 Index management
1 New index
curl -XPUT http://10.9.39.13:9200/index01
2 Read and write permissions
curl -XPUT -d'{"blocks.read":false}' http://10.9.39.13:9200/index01/_settings
3 View index
single
curl -XGET http://10.9.39.13:9200/index01/_settings
multiple
curl -XGET http://10.9.39.13:9200/index01,blog/_settings
4 Delete index
curl -XDELETE http://10.9.39.13:9200/index02
5 opening and closing index
closed
#curl -XPOST http://10.9.39.13:9200/index01/_close
open
#curl -XPOST http://10.9.39.13:9200/index01/_open
Multiple
#curl -XPOST http://10.9.39.13:9200/index01,blog,index02/_close
#curl -XPOST http://10.9.39.13:9200/index01,blog,index02/_open
2 Document Management
1 Create a new document
curl -XPUT -d'{"id":1,"title":"es introduction","content":"es is easy to use, easy to use, really easy to use"}' http://10.9.39.13:9200 /book/article/1
2 Get the document
curl -XGET http://10.9.39.13:9200/index01/article/1
3 Get multiple documents
curl -XGET -d'{"docs":[{"_index":"index01","_type":"article","_id":"1"},{"_index":"index01 ","_Type":"article","_id":"2"}]}' http://10.9.39.13:9200/_mget
4 Delete the document
curl -XDELETE http://10.9.39.13:9200/index01/article/1
3 Search
1 Query all documents and
prepare some document data
curl -XPUT -d'{"id":1,"title":"Introduction to es","content":"Es is easy to use and easy to use"}' http://10.9.39.13:9200/index01/ article/1
curl -XPUT -d'{"id":1,"title":"java programming ideas","content":"this is a reference book"}' http://10.9.39.13:9200/index01 /article/2
curl -XPUT -d'{"id":1,"title":"Introduction to big data","content":"Do you know what big data is, it is big data"}' http:// 10.9.39.13:9200/index01/article/3
2 match_all
curl -XGET http://10.9.39.13:9200/index01/_search -d ‘{“query”: {“match_all”: {}}}’
3 term query
curl -XGET http://10.9.39.13:9200/index01/_search -d'{"query":{"term":{"title":"java"}}}'
curl -XGET http:/ /10.9.39.13:9200/index01/_search -d'{"query":{"term":{"title":"java programming ideas"}}}'
curl -XGET http://10.9.39.13:9200/ jtdb_item/_search -d'{"query":{"term":{"title":"dual card dual"}}}'
4 match query
curl -XGET http://10.9.39.13:9200/index01/_search -d'{"query":{"match":{"title":"java programming ideas"}}}'
logstash启动
logstash -e ‘input{stdin{}}output{stdout{codec=>rubydebug}}’
4 IK tokenizer
curl -XPOST http://10.9.39.13:9200/_analyze -d'{"analyzer":"ik","text":"Java programming thought"}'
http://10.9.39.13:9200/index01/_analyze ?analyzer=ik&text=%E4%B8%AD%E5%8D%8E%E4%BA%BA%E6%B0%91%E5%85%B1%E5%92%8C%E5%9B%BD
curl
IK tokenizer
curl -XPUT -d'{"id":1,"kw":"We all love the People's Republic of China"}' http://10.9.39.13:9200/haha1/haha/1
View mapping
curl -XGET http://10.9.39.13:9200/jtdb_item/tb_item/_mapping
curl -XPUT -d ‘{“mappings”:{“article”:{“properties”:{“id”:{“type”:“long”},“title”:{“type”:“text”,“analyzer”:“ik_max_word”},“content”:{“type”:“text”,“analyzer”:“ik_max_word”}}}}}’ http://10.9.39.13:9200/index03/