Elasticsearch 常用命令

查询文档索引表数据

例如查询 test_index下test_type下的文档内容

curl -XGET 'http://localhost:9200/test_index/test_type/_search' -d '{
    "query" : {
         "match_all": {}
    }
    
}

根据条件查询数据

例如查询_id 值等于123的文档内容

curl -XPOST 'localhost:9200/test_index/xl/test_type?pretty' -H "content-type:application/json" -d '
{
  "query": { "match": {"_id":"123"} }
    }

}'

根据条件查询数据并返回指定列的数据

例如 只返回name和age列的值

curl -XPOST 'localhost:9200/test_index/xl/test_type?pretty' -H "content-type:application/json" -d '
{
  "query": { "match": {"_id":"e526ef3f89b51deb16f6eaf3d10"} },
  "_source": {
        "includes": [ "name", "age" ]
    }
    }

}'

你可能感兴趣的:(Elasticsearch 常用命令)