查询es各个状态
curl -XPUT http://192.168.1.28:9200/hd_newscurl -XPUT http://192.168.1.28:9200/hd_boxers
curl -XPUT http://192.168.1.28:9200/hd_videos
curl -XPUT http://192.168.1.28:9200/hd_community
增加数据
curl -XPUT http://192.168.1.28:9200/hd_news/fulltext/_mapping -d'{"properties": {"content": {"type": "text","analyzer":"ik_max_word","search_analyzer": "ik_max_word"}}}'curl -XPUT http://192.168.1.28:9200/hd_boxers/fulltext/_mapping -d'{"properties": {"content": {"type": "text","analyzer":"ik_max_word","search_analyzer": "ik_max_word"}}}'
curl -XPUT http://192.168.1.28:9200/hd_videos/fulltext/_mapping -d'{"properties": {"content": {"type": "text","analyzer":"ik_max_word","search_analyzer": "ik_max_word"}}}'
curl -XPUT http://192.168.1.28:9200/hd_community/fulltext/_mapping -d'{"properties": {"content": {"type": "text","analyzer":"ik_max_word","search_analyzer": "ik_max_word"}}}'
curl -XPUT http://192.168.1.28:9200/hd_news/fulltext/1 -d'{"content":"旧上海的拳击人"}'
curl -XPUT http://192.168.1.28:9200/hd_news/fulltext/2 -d'{"content":"邹市明职业生涯"}'
curl -XPUT http://192.168.1.28:9200/hd_news/fulltext/3 -d'{"content":"月拳年刀一辈子枪"}'
curl -XPUT http://192.168.1.28:9200/hd_videos/fulltext/1 -d'{"content":"IBU杭州站视频回顾"}'
curl -XPUT http://192.168.1.28:9200/hd_videos/fulltext/2 -d'{"content":"跟美女学波比跳"}'
curl -XPUT http://192.168.1.28:9200/hd_videos/fulltext/3 -d'{"content":"帕奎奥精彩视频"}'
curl -XPUT http://192.168.1.28:9200/hd_boxers/fulltext/1 -d'{"content":"邹市明"}'
curl -XPUT http://192.168.1.28:9200/hd_boxers/fulltext/2 -d'{"content":"帕奎奥"}'
curl -XPUT http://192.168.1.28:9200/hd_boxers/fulltext/3 -d'{"content":"木村翔"}'
curl -XPUT http://192.168.1.28:9200/hd_community/fulltext/1 -d'{"content":"邹市明为什么败给了木村翔"}'
curl -XPUT http://192.168.1.28:9200/hd_community/fulltext/2 -d'{"content":"女生可以学拳吗"}'
curl -XPUT http://192.168.1.28:9200/hd_community/fulltext/3 -d'{"content":"IBU有拳王吗"}'查询数据
XGET http://192.168.1.28:9200/hd_news/fulltext/1 查询单条
删除数据
XDELETE http://192.168.1.28:9200/hd_news/fulltext/1 删除单条查询数据
curl -XPOST http://192.168.1.28:9200/hd_community/fulltext/_search -d'{"query" : { "match" : { "content" : "邹市明" }},"highlight" : {"pre_tags" : ["<tag1>", "<tag2>"], "post_tags" : ["</tag1>", "</tag2>"],"fields" : {"content" : {}}}}'查询结果
{"took":3,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":0.5446649,"hits":[{"_index":"hd_community","_type":"fulltext","_id":"1","_score":0.5446649,"_source":{"content":"邹市明为什么败给了木村翔"},"highlight":{"content":["<tag1>邹</tag1><tag1>市</tag1>明为什么败给了木村翔"]}}]}}
查询格式
{"query": {
"match": {
"content": "邹明"
}
}
}