
本文共 2700 字,大约阅读时间需要 9 分钟。
������Elasticsearch������������������������������
���������������������������������������������������������Elasticsearch���������������������������������������������������������������������������������������������������������������������������������������
������������Elasticsearch
������Elasticsearch���������������������������������������������������������Elasticsearch���������������������������������������
./bin/elasticsearch -d
������������������������
������������������������������������������������������������������������
ps aux | grep elasticsearch
������������������ elasticsearch
���������������������Elasticsearch���������������������
������������������
���������������������������curl���������������������������������������������������������������������
- ���������������
csdn
- ���������index���**���**people
- ������ID���
1
- ���������name���age���profile���hobby
������������������������������������������������
curl -X PUT "localhost:9200/csdn/people/1?pretty" -H 'Content-Type: application/json' -d({ "name": "$2", "age": "$3", "profile": "$4", "hobby": ["$5", "$6"]})
���������������������������������������������������������������������
������������������������������������
���������������������������������������������������������������������������������������������������Bash���������������
#!/bin/bash# ������������: sh 01-insert-data.sh ID name age profile hobby ...# ������������������if [[ $# -gt 1 ]]; then ID=$1 name=$2 age=$3 profile=$4 hobby=$5 ������="}" if [[ $6 ]]; then hobby=','$6'; fi if [[ $7 ]]; then hobby=','$7'; fi data="{ \"name\": \"$name\", \"age\": \"$age\", \"profile\": \"$profile\", \"hobby\": [${hobby}] }" curl -X PUT "localhost:9200/csdn/people/${ID}?pretty" -H 'Content-Type: application/json' -d ${data} exit 0fi
������������������������
������������������������������������������������������������������
curl -X GET "localhost:9200/csdn/people/1/_source
���������������JSON������������������������������������������������������������������������������ES ���������������
������������������������
������������������
- ���������������������������������������Elasticsearch���restapi������CRUD���������
- ���������������������������������������������Elasticsearch������������������������������������������������������
���������������������������������������������������
发表评论
最新留言
关于作者
