如何用curl向elasticsearch添加数据并且搜索

如何用curl向elasticsearch添加数据

```
curl -H "Content-Type: application/json" -XPUT '192.168.2.238:9200/articles/article/8236' -d '{"id" : 8236 ,"title":"elasticsearch中文分词插件ik安装及测试"}'
curl -H "Content-Type: application/json" -XPUT '192.168.2.238:9200/articles/article/8235' -d '{"id" : 8235 ,"title":"elasticsearch默认standard分词测试analyzer"}'
curl -H "Content-Type: application/json" -XPUT '192.168.2.238:9200/articles/article/8233' -d '{"id" : 8233 ,"title":"docker安装elasticsearch全文检索引擎"}'
```

然后在elasticsearch-head中查找

```
{
"query": {
"multi_match": {
"query": "jumpserver",
"fields": [
"title"
]
}
},
"highlight": {
"fields": {
"title": {}
}
}
}
```

![](https://static.yuanchengzhushou.cn/image/8238.jpg)

    A+
发布日期:2021年05月30日  所属分类:未分类

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: