elasticsearch操作命令


總結幾個es的curl操作命令:

查詢某條數據:curl -XGET http://elasticsearch:9200/company/company/123?pretty

查詢索引下數據總量:curl -XGET http://elasticsearch:9200/company/company/_count?pretty

根據條件查詢:curl -XGET http://elasticsearch:9200/company/company/_search?pretty -d '{"query": {"bool":{"must":[{"term":{"aId":"10"}},{"term":{"uId":"333"}}]}}}'

復制一個索引:curl -XPOST 'http://elasticsearch:9200/_reindex' -d '{"source": {"index": "company"},"dest": {"index": "company_bak","op_type": "create"}}'

查看所有索引狀態:curl -XGET 'http://elasticsearch:9200/_cat/indices?v' 

清空某個索引數據:curl -XPOST 'http://elasticsearch:9200/company/company/_delete_by_query?refresh&slices=5&pretty' -H 'Content-Type: application/json' -d '{"query": {"match_all": {}}}'

在某個索引下添加mapping:curl -XGET http://elasticsearch:9200/_mapping/company' -d '{"properties": {"address": {"type": "text","fields": {"keyword": {"type": "keyword","ignore_above": 256}}}}}'


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM