栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

es基本操作(7.10.x)

es基本操作(7.10.x)

批量插入:

POST consultation/_bulk
{"index":{"_index":"consultation", "_type":"_doc", "_id": 1539943}}
{"id": 1539943,"createdOn": "2021-12-24 17:47:34","consultNumber": "CN-202112241747HVWN","consultType": "ImageText","inquiryTimes": 2,"hasInquiryTimes": 2,"consultState": "return","overtimeRemindTimes": 0,"purchaseTimes": 2,"hasPurchaseTimes": 2,"overtime": "2021-12-25 17:47:34","completetime": "2021-12-25 17:47:34","membershipLevel": 100,"serviceMoneyListId": 11021,"consultantID": 0,"userId": "ug9lqaP@qIV6Duyy:*2iY","consultantName": "幻惑之风","doctorName": "幻惑之风","patientID": 2029725,"patientName": "123456","age": "17岁8月","sex": 1,"hasReply": false,"inquiryPurchaseCnt": 0,"authorise": false,"departmentId": 0,"serviceState": "normal","expectExpire": false,"callStatus": false,"hasRemark": false,"merchantInfo": {"merchantId": "2BEE2FF0"},"iiinessType": "先天性心脏病","iiinessDescription": "hfjdnd","doctorID": "ug9lqaP@qIV6Duyy:*2iY","isInquiry": false,"isRTAuthorize": false}
{"index":{"_index":"consultation", "_type":"_doc", "_id": 1539898}}
{"id": 1539898,"createdOn": "2021-12-24 10:16:23","consultNumber": "CN-202112241016PSva","consultType": "ImageText","inquiryTimes": 2,"hasInquiryTimes": 2,"consultState": "return","overtimeRemindTimes": 0,"purchaseTimes": 2,"hasPurchaseTimes": 2,"overtime": "2021-12-25 10:16:23","completetime": "2021-12-25 10:16:23","membershipLevel": 100,"serviceMoneyListId": 11021,"consultantID": 0,"userId": "ug9lqaP@qIV6Duyy:*2iY","consultantName": "幻惑之风","doctorName": "幻惑之风","patientID": 2029725,"patientName": "123456","age": "17岁8月","sex": 1,"hasReply": false,"inquiryPurchaseCnt": 0,"authorise": false,"departmentId": 0,"serviceState": "normal","expectExpire": false,"callStatus": false,"hasRemark": false,"merchantInfo": {"merchantId": "2BEE2FF0"},"iiinessType": "先天性心脏病","iiinessDescription": "hfjdnd","doctorID": "ug9lqaP@qIV6Duyy:*2iY","isInquiry": false,"isRTAuthorize": false}

 查询所有索引:

GET _cat/indices?v

 查询索引配置:

GET /video_v1/_settings

查询索引字段映射:

GET entry_v1/_mapping

插入索引并设置映射:

PUT consultation_v1
{
  "mappings": {
      "properties": {
        "consultationReplyList": {
          "type": "nested",
          "properties": {
            "repayIllnessDescription": {
              "type": "text",
              "analyzer": "ik_max_word"
            }
          }
        },
        "age": {
          "type": "text",
          "analyzer": "ik_max_word"
        },
        "authorise": {
          "type": "boolean"
        },
        "completetime": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"
        },
        "consultNumber": {
          "type": "keyword"
        },
        "consultState": {
          "type": "keyword"
        },
        "consultType": {
          "type": "keyword"
        },
        "consultantID": {
          "type": "long"
        },
        "consultantName": {
          "type": "text",
          "analyzer": "ik_max_word"
        },
        "createdBy": {
          "type": "long"
        },
        "createdOn": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"
        },
        "deleteBy": {
          "type": "long"
        },
        "deleteTime": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"
        },
        "doctorCode": {
          "type": "keyword"
        },
        "doctorID": {
          "type": "long"
        },
        "doctorName": {
          "type": "text",
          "analyzer": "ik_max_word"
        },
        "hasInquiryTimes": {
          "type": "long"
        },
        "hasPurchaseTimes": {
          "type": "long"
        },
        "hasReply": {
          "type": "boolean"
        },
        "iIInessDescription": {
          "type": "text",
          "analyzer": "ik_max_word"
        },
        "iIInessType": {
          "type": "text",
          "analyzer": "ik_max_word"
        },
        "id": {
          "type": "long"
        },
        "inquiryTimes": {
          "type": "long"
        },
        "isDelete": {
          "type": "boolean"
        },
        "isevaluate": {
          "type": "boolean"
        },
        "isReturnVisit": {
          "type": "boolean"
        },
        "modifyBy": {
          "type": "long"
        },
        "modifyOn": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"
        },
        "orderType": {
          "type": "long"
        },
        "overtime": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"
        },
        "overtimeRemindTimes": {
          "type": "long"
        },
        "patientCity": {
          "type": "text",
          "analyzer": "ik_max_word"
        },
        "patientID": {
          "type": "long"
        },
        "patientName": {
          "type": "text",
          "analyzer": "ik_max_word"
        },
        "phoneNumber": {
          "type": "text",
          "analyzer": "ik_max_word"
        },
        "platform": {
          "type": "keyword"
        },
        "purchaseTimes": {
          "type": "long"
        },
        "questionsDescription": {
          "type": "text",
          "analyzer": "ik_max_word"
        },
        "recommendDoctorCode": {
          "type": "keyword"
        },
        "recommendDoctorID": {
          "type": "long"
        },
        "recommendDoctorName": {
          "type": "text",
          "analyzer": "ik_max_word"
        },
        "refundBy": {
          "type": "long"
        },
        "refundNumber": {
          "type": "text",
          "analyzer": "ik_max_word"
        },
        "refundReason": {
          "type": "text",
          "analyzer": "ik_max_word"
        },
        "refundRemarks": {
          "type": "text",
          "analyzer": "ik_max_word"
        },
        "refundState": {
          "type": "keyword"
        },
        "refundTime": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"
        },
        "refundTitle": {
          "type": "text",
          "analyzer": "ik_max_word"
        },
        "refundType": {
          "type": "keyword"
        },
        "returnVisit": {
          "type": "text",
          "analyzer": "ik_max_word"
        },
        "returnVisitTime": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"
        },
        "serviceMoneyListId": {
          "type": "long"
        },
        "tipsed": {
          "type": "boolean"
        },
        "userDelete": {
          "type": "boolean"
        },
        "userId": {
          "type": "keyword"
        }
      }
    }
}

复合查询:

GET consultation/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "doctorCode": {
              "value": "o9~*-HRwHV6bZCQADtaOY"
            }
          }
        },
        {
          "term": {
            "isDelete": false
          }
        },
        {
          "bool": {
            "should": [
              {
                "term": {
                  "consultState": {
                    "value": "return"
                  }
                }
              },
              {
                "bool": {
                  "must": [
                    {
                      "term": {
                        "hasReply": {
                          "value": true
                        }
                      }
                    },
                    {
                      "term": {
                        "consultState": {
                          "value": "success"
                        }
                      }
                    }
                  ]
                }
              },
              {
                "bool": {
                  "must": [
                    {
                      "term": {
                        "hasReply": {
                          "value": true
                        }
                      }
                    },
                    {
                      "term": {
                        "consultState": {
                          "value": "commentexpire"
                        }
                      }
                    }
                  ]
                }
              }
            ]
          }
        },
        {
          "bool": {
            "should": [
              {
                "nested": {
                  "path": "consultationReplyList",
                  "query": {
                    "term": {
                      "consultationReplyList.repayIllnessDescription": {
                        "value": "开放"
                      }
                    }
                  }
                }
              },
              {
                "term": {
                  "iIInessDescription": "开放"
                }
              },
              {
                "term": {
                  "iIInessType": "开放"
                }
              },
              {
                "term": {
                  "patientName": "开放"
                }
              }
            ]
          }
        }
      ],
      "must_not": [
        {
          "term": {
            "consultState": {
              "value": "commentexpire"
            }
          }
        }
      ]
    }
  },
  "from": 0,
  "size": 200,
  "sort": [
    {
      "createdOn": {
        "order": "desc"
      }
    }
  ]
}

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/742070.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号