curl -XPOST http://192.168.85.143:9200/index/_mapping -H ‘Content-Type:application/json’ -d’
{
“properties”: {
“content”: {
“type”: “text”,
“analyzer”: “ik_max_word”,
“search_analyzer”: “ik_smart”
}
}
}’
curl -XPOST http://192.168.85.143:9200/index/_create/1 -H ‘Content-Type:application/json’ -d’
{“content”:”美国留给伊拉克的是个烂摊子吗”}’
curl -XPOST http://192.168.85.143:9200/index/_create/2 -H ‘Content-Type:application/json’ -d’
{“content”:”公安部:各地校车将享最高路权”}
‘
curl -XPOST http://192.168.85.143:9200/index/_create/3 -H ‘Content-Type:application/json’ -d’
{“content”:”中韩渔警冲突调查:韩警平均每天扣1艘中国渔船”}
‘
curl -XPOST http://192.168.85.143:9200/index/_create/4 -H ‘Content-Type:application/json’ -d’
{“content”:”中国驻洛杉矶领事馆遭亚裔男子枪击 嫌犯已自首”}
‘
‘
curl -XPOST http://192.168.85.143:9200/index/_create/5 -H ‘Content-Type:application/json’ -d’
{“content”:”我是中国人”}’
curl -XPOST http://192.168.85.143:9200/index/_search?pretty -H ‘Content-Type:application/json’ -d’
{
“query” : { “match” : { “content” : “中国” }},
“highlight” : {
“pre_tags” : [“
“post_tags” : [“
“fields” : {
“content” : {}
}
}
}
‘
curl -XPOST http://192.168.85.143:9200/index/_search?pretty -H ‘Content-Type:application/json’ -d’
{
“query” : { “match” : { “content” : “渔船” }},
“highlight” : {
“pre_tags” : [“
“post_tags” : [“
“fields” : {
“content” : {}
}
}
}
‘