URI kullanarak Elasticsearch'e erişim mümkün. API başlıkları şöyle
Document APISearch APIIndices APIcat APIIngest APICluster API
Search API
Bu arama yöntemi REST + JSON yöntemine göre biraz daha kısıtlı. Açıklaması şöyle
Although the URI search is a simple and efficient way to query your cluster, you’ll quickly find that it doesn’t support all of the features ES offers. The full power of Elasticsearch is evident through Request Body Search. Using Request Body Search allows you to build a complex search request using various elements and query clauses that will match, filter, and order as well as manipulate documents depending on multiple criteria.
Örnek
Şöyle yaparız
“localhost:9200/_search?q=name:john~1 AND (age:[30 TO 40} OR surname:K*) AND -city”
Ingest API
Örnek - Insert
Şöyle yaparız
curl -XPUT -H "Content-Type: application/json" http://localhost:9200/employee/_doc/1000?pretty -d ' { "name": "Steve", "age": 23, "experienceInYears": 1 }' { "_index" : "employee", "_type" : "_doc", "_id" : "1000", "_version" : 1, "result" : "created", "_shards" : { "total" : 2, "successful" : 1, "failed" : 0 }, "_seq_no" : 0, "_primary_term" : 1 }
Örnek - Update
Şöyle yaparızcurl -XPOST -H "Content-Type: application/json"alo http://localhost:9200/employee/_doc/1000/_update?pretty -d ' { "doc" : { "name": "Smith" } }' { "_index" : "employee", "_type" : "_doc", "_id" : "1000", "_version" : 2, "result" : "updated", "_shards" : { "total" : 2, "successful" : 1, "failed" : 0 }, "_seq_no" : 1, "_primary_term" : 1 }
Örnek - Delete
Şöyle yaparızcurl -XDELETE -H "Content-Type: application/json" http://localhost:9200/employee/_doc/1000?pretty { "_index" : "employee", "_type" : "_doc", "_id" : "1000", "_version" : 3, "result" : "deleted", "_shards" : { "total" : 2, "successful" : 1, "failed" : 0 }, "_seq_no" : 2, "_primary_term" : 1 }
Hiç yorum yok:
Yorum Gönder