欢迎您访问365答案网,请分享给你的朋友!
生活常识 学习资料

es基本操作(7.10.x)

时间:2023-05-13

批量插入:

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" } } ]}

Copyright © 2016-2020 www.365daan.com All Rights Reserved. 365答案网 版权所有 备案号:

部分内容来自互联网,版权归原作者所有,如有冒犯请联系我们,我们将在三个工作时内妥善处理。