elasticsearch 2.1.0 curl 관련 조작 명령(1)
8657 단어 elasticsearch분산 검색 분석 엔진
(1) http://10.4.30.81:9200/_plugin/head/
http://10.4.30.151:9200/_plugin/head/
(2)
curl 'http://10.4.30.81:9200/?pretty'
curl 'http://10.4.30.151:9200/?pretty'
java api
https://www.elastic.co/guide/en/elasticsearch/client/java-api/2.0/node-client.html
https://www.elastic.co/guide/en/elasticsearch/client/java-api/2.1/transport-client.html
(3-1) ( )
curl -XPUT 'http://10.4.30.151:9200/megacorp/employee/11' -d '{
"first_name" : "John4",
"last_name" : "Smith4",
"age" : 35,
"about" : "I love to go rock climbing3",
"interests": [ "sports4" ],
"yujie_name":"wangyujie"
}'
Elasticsearch 。 ( ), _version
(3-2) post id
curl -XPOST 'http://10.4.30.151:9200/megacorp/employee?pretty' -H 'Content-Type: application/json' -d'{
"first_name" : "John7",
"last_name" : "Smith7",
"age" : 37,
"about" : "I love to go rock climbing7",
"interests": [ "sports7" ]
}'
:
{
"_index" : "megacorp",
"_type" : "employee",
"_id" : "AWBNtXOoxFnukAxvHpYx",
"_version" : 1,
"_shards" : {
"total" : 2,
"successful" : 2,
"failed" : 0
},
"created" : true
}
(3-3) ;
curl -XPUT 'http://10.4.30.151:9200/megacorp/employee/1?op_type=create' -d '{
"first_name" : "John4",
"last_name" : "Smith4",
"age" : 35,
"about" : "I love to go rock climbing3",
"interests": [ "sports4" ]
}'
curl -XPUT 'http://10.4.30.151:9200/megacorp/employee/1/_create' -d '{
"first_name" : "John4",
"last_name" : "Smith4",
"age" : 35,
"about" : "I love to go rock climbing3",
"interests": [ "sports4" ]
}'
ID URL-safe、 Base64 20 GUID 。
GUID FlakeID , ID ,
(4-1) id
curl -XGET 'http://10.4.30.151:9200/megacorp/employee/1'
:
{"_index":"megacorp","_type":"employee","_id":"1","_version":1,"found":true,"_source":
{
"first_name" : "John",
"last_name" : "Smith",
"age" : 25,
"about" : "I love to go rock climbing",
"interests": [ "sports", "music" ]
}}
(4-2) id _source
curl -XGET 'http://10.4.30.151:9200/megacorp/employee/1/_source?pretty'
:
{
"first_name" : "John",
"last_name" : "Smith",
"age" : 25,
"about" : "I love to go rock climbing",
"interests": [ "sports", "music" ]
}
(4-3) HEAD
curl -i -XHEAD 'http://10.4.30.151:9200/megacorp/employee/1'
, Elasticsearch 200 ok , 404
(4-4)
curl -XDELETE 'http://10.4.30.151:9200/megacorp/employee/1?pretty'
(4-5)es
curl -XPUT 'http://10.4.30.151:9200/megacorp/employee/1?version=1&pretty' -H 'Content-Type: application/json' -d'{
"title": "My first blog entry",
"text": "Starting to get the hang of this..."
}'
es version=2, 409 Conflict HTTP 。
es , , 1 。
(4-6)
curl -XPOST 'http://10.4.30.151:9200/megacorp/employee/4/_update?pretty' -H 'Content-Type: application/json' -d'{
"doc" : {
"tags" : [ "testing" ],
"views": 0
}
}'
,
(4-7)
curl -XGET 'http://10.4.30.151:9200/_mget?pretty' -H 'Content-Type: application/json' -d'
{
"docs" : [
{
"_index" : "megacorp",
"_type" : "employee",
"_id" : 2
},
{
"_index" : "website",
"_type" : "pageviews",
"_id" : 1,
"_source": "views"
}
]
}'
, ids
curl -XGET 'http://10.4.30.151:9200/megacorp/employee/_mget?pretty' -H 'Content-Type: application/json' -d'{
"ids" : [ "1", "2" ,"3","4","5"]
}'
(5-1) 10
curl -XGET 'http://10.4.30.151:9200/megacorp/employee/_search'
(5-2) 10
curl -XGET 'http://10.4.30.151:9200/_search?pretty'
curl -XGET 'http://10.4.30.151:9200/_search?pretty' -H 'Content-Type: application/json' -d'{
"query": {
"match_all": {}
}
}'
(5-3) size: ,from:
curl -XGET 'http://10.4.30.151:9200/_search?size=5&pretty'
curl -XGET 'http://10.4.30.151:9200/_search?size=5&from=5&pretty'
curl -XGET 'http://10.4.30.151:9200/_search?size=5&from=10&pretty'
curl -XGET 'http://10.4.30.151:9200/_search?pretty' -H 'Content-Type: application/json' -d'{
"from": 5,
"size": 4}'
(6)( ) megacorp employee last_name Smith
curl -XGET 'http://10.4.30.151:9200/megacorp/employee/_search?q=last_name:wang6&pretty'
curl -XGET 'http://10.4.30.151:9200/_search?pretty' -H 'Content-Type: application/json' -d '{
"query": {
"match": {
"last_name": "wang6"
}
}
}'
(7)DSL( ) (6)
curl -XGET 'http://10.4.30.151:9200/_search?pretty' -H 'Content-Type: application/json' -d '{
"query": {
"match": {
"last_name": "wang6"
}
}
}'
filter
curl -XGET 'http://10.4.30.151:9200/_search?pretty' -H 'Content-Type: application/json' -d '{
"query" : {
"bool" : {
"filter" : {
"term" : {
"last_name": "wang6"
}
}
}
}
}'
(8)
curl -XGET 'http://10.4.30.151:9200/megacorp/employee/_search' -d '{
"query" : {
"bool": {
"must": {
"match" : {
"last_name" : "smith"
}
},
"filter": {
"range" : {
"age" : { "gt" : 30 } // 30 grant than
}
}
}
}
}'
(9)
curl -XGET 'http://10.4.30.151:9200/megacorp/employee/_search' -d '{
"query" : {
"match" : {
"about" : "rock climbing"
}
}
}'
(10)
curl -XGET 'http://10.4.30.151:9200/megacorp/employee/_search' -d '{
"query" : {
"match_phrase" : {
"about" : "rock climbing"
}
}
}'
(11)
curl -XGET 'http://10.4.30.151:9200/megacorp/employee/_search' -d '{
"query" : {
"match_phrase" : {
"about" : "rock climbing"
}
},
"highlight": {
"fields" : {
"about" : {}
}
}
}'
(12)
curl -XGET 'http://10.4.30.151:9200/_cluster/health?pretty'
(13)
curl -XPUT 'http://10.4.30.151:9200/blogs' -d '{
"settings" : {
"number_of_shards" : 3,
"number_of_replicas" : 1
}
}'
, , ,
_type , , , 256
_id , index API 。
(14)
curl -XPUT 'http://10.4.30.151:9200/blogs/_settings' -d '{
"number_of_replicas" : 2
}'
, ,
。
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
kafka connect e elasticsearch를 관찰할 수 있습니다.No menu lateral do dashboard tem a opção de connectors onde ele mostra todos os clusters do kafka connect conectados atu...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.