اگر که تا به حال با Elasticsearch کار کرده باشید، قطعا متوجه شده اید که چه محصول شگفت انگیزی هستش. اما می تونه در عرض یک دقیقه این شگفت انگیز بودن تبدیل به خسته کننده شود.
و به همین خاطر هستش که ما برای شما یک cheat sheet تهیه کردیم تا یک سری از دستورات کاربردیElasticsearch را با شما به اشتراک بگذاریم تا از تکرار آنها در طولانی مدت خسته نشوید.
لیست کردن همه ی indice ها :
curl -X GET ‘http://localhost:9200/_cat/indices?v
یا
curl -v "localhost:9200/_cat/indices"
حذف index مورد نظر :
curl -X DELETE 'http://localhost:9200/examples'
بک آپ گرفتن از یک index :
curl -XPOST --header 'Content-Type: application/json' http://localhost:9200/_reindex -d '{ "source": { "index1": "someexamples" }, "dest": { "index2": "someexamples_copy" }}'
لیست کردن همه ی داکیومنت های یک index :
curl -X GET 'http://localhost:9200/elasticsearch_query_examples/_search'
لیست کردن همه ی dataها :
curl -XPUT --header 'Content-Type: application/json' http://localhost:9200/elasticsearch_query_examples/_doc/1 -d '{ "value1" : "value2"}'
انتقال shardها از یک node به node دیگر :
curl -XPOST 'http://localhost:9200/_cluster/reroute' -d '{"commands" : [{"move" :{"index" : "indexname", "shard" : 1,"from_node" : "nodename", "to_node" : "nodename"}}]}';echo
حذف کردن nodeها از یک cluster :
curl -XPUT localhost:9200/_cluster/settings -d '{"transient" :{"cluster.routing.allocation.exclude._ip" : "1.2.3.4"}}';echo
تغییر سایز صف search :
curl -XPUT localhost:9200/_cluster/settings -d '{"transient" :{"threadpool.search.queue_size" : 2000}}';echo
پاک کردن cache:
curl -XPOST 'http://localhost:9200/_cache/clear'
تغییر تعداد shard پیشفرض :
curl -XPUT localhost:9200/_template/index_defaults -d '{"template": "*", "settings": { "number_of_shards": 4 }}';echo
“I’m a self-motivated and curious person with a weapon named “search
0 دیدگاه در “Elasticsearch Cheat Sheet” افزودن → خودتان