一、查询操作
查看当前索引的数据结构 _mapping
可以查看索引下有哪些字段,以及对应的类型
这个待商榷
还可以查看是否配置分词器,如果没有analyzer和searchAnalyzer ,则说明使用的是默认的分词器
GET ai-open-alarm*/_mapping
{
"size": 100,
"query": {
"match_all": {}
}
}
查询当前索引下的文档数以及分片信息 _count
Get ai-open-log*/_count
{
"count": 12345, //当前索引下的文档总数
"_shards": { //分片信息
"total": 5, // 总分片数
"successful": 5, // 成功处理的分片数
"skipped": 0, // 跳过的分片数
"failed": 0 // 失败的分片数
}
}
做查询操作,同时返回结果集的大小最大为100,不做任何筛选条件 match_all
GET ai-open-alarm-2024.12.02/_search
{
"size": 100,
"query": {
"match_all": {}
}
}
做单条件查询,不加must,那也不能加bool
Get ai-open-log*/_search
{
"query": {
"match": {
"payload.input.user_uuid.keyword": {
"