ES7.5版本 kibana 操作语法

原创
2021/01/29 09:10
阅读数 957
AI总结

DELETE business_info
PUT business_info/
{
  "settings": {
    "analysis": {
      "analyzer": {
        "notice_analyzer":{
          "char_filter":["html_strip"],
          "tokenizer":"ik_max_word"
        }
      }
    },"number_of_shards": 1,
    "number_of_replicas": 1
  },
  "mappings": { 
      "properties" : {
        "cityNames" : {
          "type" : "keyword"
        },
        "count" : {
          "type" : "integer"
        },
        "createDate" : {
          "type" : "long"
        },
        "dealerName" : {
          "type" : "text",
          "search_analyzer": "ik_smart", 
          "analyzer" : "ik_smart"
        },
        "did" : {
          "type" : "long"
        },
        "hospitals" : {
          "type" : "keyword"
        },
        "pid" : {
          "type" : "integer"
        },
        "pname" : {
          "type" : "keyword"
        },
        "status" : {
          "type" : "short"
        },
        "type" : {
          "type" : "short"
        }
      }
    }
  
}
DELETE notice_info
PUT notice_info/
{
    "settings": {
    "analysis": {
      "analyzer": {
        "notice_analyzer":{
          "char_filter":["html_strip"],
          "tokenizer":"ik_max_word"
        }
      }
    },"number_of_shards": 1,
    "number_of_replicas": 1
  },
"mappings" : {
      "properties" : {
        "areaName" : {
          "type" : "keyword"
        },
        "areaid" : {
          "type" : "short"
        },
        "cityName" : {
          "type" : "keyword"
        },
        "cityid" : {
          "type" : "short"
        },
        "content" : {
          "type" : "text",
          "analyzer" : "notice_analyzer",
          "search_analyzer" : "ik_max_word",
          "fielddata" : true
        },
        "createDate" : {
          "type" : "long"
        },
        "dealer" : {
          "type" : "nested",
          "include_in_parent" : true,
          "properties" : {
            "did" : {
              "type" : "long"
            },
            "name" : {
              "type" : "text",
              "search_analyzer" : "ik_smart",
              "analyzer" : "ik_smart"
            },
            "type" : {
              "type" : "short"
            }
          }
        },
        "id" : {
          "type" : "long"
        },
        "pid" : {
          "type" : "integer"
        },
        "pname" : {
          "type" : "keyword"
        },
        "title" : {
          "type" : "text",
           "search_analyzer" : "ik_smart",
          "analyzer" : "ik_smart"
        }
      }
    }
  
}
GET notice_info/_analyze
{
  "analyzer": "ik_smart",
  "text":[ """<div> <div>东芝320CT保修服务采购合同 /index_01"""]
}


POST notice_info_trial/_update/6/
{
  "script": "ctx._source.id = 6", 
  "upsert": {
    "id": 6
  }
}

GET notice_info/_search
{
  "query": {
    "range": {
      "createDate": {
        "gt": "1546272000",
        "lt": "1551369600"
      }
    }
  },
  "highlight": {
    "fields": {
      "*": {}
    }
  }
}

GET notice_info/_search
{
      "query": {
        "bool": {
          "must": [
          { "match": { "cityid": 11 } }
          
        ],
        "should": [
          { "match": { "content": "电梯" }}
        ]
    }
  }
}
GET notice_info/_search
{
  "query": {
    "bool": {
      "must_not": [
        {
          "exists": {
            "field": "content"
          }
          
        }
      ]
    }
  }
}

POST business_info/_search/
{
"size": 0, 

"aggs": {
  
  "max_did": {
    
    "max": {
      "field": "did"
    
    }
  }
}
}

POST _reindex?wait_for_completion=false
{
  "source": {"index": "notice_info"},
  "dest": {"index": "notice_info_new"
  }
  
}

DELETE notice_info_new
PUT notice_info_new/
{
  "settings": {
    "analysis": {
      "analyzer": {
        "notice_analyzer":{
          "char_filter":["html_strip"],
          "tokenizer":"ik_max_word"
        }
      }
    },"number_of_shards": 2,
    "number_of_replicas": 1
  },
  "mappings": {
    "properties": {
      "content": {
        "type": "text",
        "search_analyzer": "ik_max_word",
        "analyzer": "notice_analyzer"
        
      },
      "cityid": {
        "type": "short"
      },
      "cityName": {
        "type": "keyword"
      },
      "id": {
        "type": "long"
      },      
      "name": {
        "type": "text",
        "analyzer": "ik_smart"
      },
      "title": {
        "type": "text",
        "search_analyzer": "ik_max_word",
        "analyzer": "ik_max_word"
      },
      "did": {
        "type": "long"
      },     
      "dname": {
        "type": "text",
        "analyzer": "ik_smart"
      },
      "createDate": {
        "type": "long"
      },
      "cid": {
        "type": "long"
      }
    }
  }
}

POST /notice_info_new/_mappings
{
  "properties": {
        "content": {
             "type" : "text",
          "analyzer" : "notice_analyzer",
            "fielddata": true
            }
        }
}

POST notice_info_new/_update_by_query
{
  "query": {
   "range": {
     "createDate": {
       "gte": 1000000000000,
       "lte": 9111111111000000
     }
   }
  },
  "script":{
    "lang": "painless",
    "source": "ctx._source.createDate=ctx._source.createDate / 1000 "
  }
  
}

DELETE notice_info_new
PUT notice_info_new/
{
  "settings": {
    "analysis": {
      "analyzer": {
        "notice_analyzer":{
          "char_filter":["html_strip"],
          "tokenizer":"ik_max_word"
        }
      }
    },"number_of_shards": 1,
    "number_of_replicas": 1
  },
  "mappings": {
    "properties": {
        "cid" : {
          "type" : "long"
        },
        "cityName" : {
          "type" : "keyword"
        },
        "cityid" : {
          "type" : "short"
        },
        "content" : {
          "type" : "text",
          "search_analyzer": "notice_analyzer", 
          "analyzer" : "notice_analyzer",
          "fielddata" : true
        },
        "createDate" : {
          "type" : "long"
        },
        "did" : {
          "type" : "long"
        },
        "dname" : {
          "type" : "text",
          "analyzer" : "ik_smart"
         
        },
        "pid" : {
          "type" : "integer"
        },
        "pname" : {
          "type" : "keyword"
        },
        "tid" : {
          "type" : "long"
        },
        "title" : {
          "type" : "text",
          "analyzer" : "ik_smart"
        },
        "tname" : {
          "type" : "text",
          "analyzer" : "ik_smart"
        },
        "type" : {
          "type" : "short"
        }
      }
  }
}


POST business_info/_update_by_query
{

  "script": {
    "lang": "painless",
    "source": "if (ctx._source.status == null) {ctx._source.status= 0}"
  }
}


POST business_info/_update_by_query
{

  "script": {
    "lang": "painless",
    "source": "ctx._source.remove(\"status_code\")"
  }
}

POST notice_info_new/_update_by_query?wait_for_completion=false
{

  "script": {
    "lang": "painless",
    "source": "ctx._source.content == ctx._source.content"
  }
}

POST notice_info_new/_update/10
{

  "script": {
    "lang": "painless",
    "source": "ctx._source.title =\"眼科光学生物测量仪采购中标公告\"" 
  }
}

PUT _cluster/settings
{
  "transient": {
    "script.max_compilations_rate": "100/1m"
  }
}

DELETE dealer_info
PUT dealer_info/
{
  "settings": {
    "analysis": {
      "analyzer": {
        "notice_analyzer":{
          "char_filter":["html_strip"],
          "tokenizer":"ik_max_word"
        }
      }
    },"number_of_shards": 1,
    "number_of_replicas": 1
  },
  "mappings": { 
      "properties" : {
        "cityNames" : {
          "type" : "keyword"
        },
        "count" : {
          "type" : "integer"
        },
        "createDate" : {
          "type" : "long"
        },
        "dealerName" : {
          "type" : "text",
          "search_analyzer": "notice_analyzer", 
          "analyzer" : "notice_analyzer"
        },
        "did" : {
          "type" : "long"
        },
        "hospitals" : {
          "type" : "keyword"
        },
        "pid" : {
          "type" : "integer"
        },
        "pname" : {
          "type" : "keyword"
        },
        "status" : {
          "type" : "short"
        },
        "type" : {
          "type" : "short"
        }, "dtype" : {
          "type" : "short"
        }
      }
    }
  
}

DELETE dealer_notice_record
PUT dealer_notice_record/
{
  "settings": {
    "analysis": {
      "analyzer": {
        "notice_analyzer":{
          "char_filter":["html_strip"],
          "tokenizer":"ik_max_word"
        }
      }
    },"number_of_shards": 1,
    "number_of_replicas": 1
  },
  "mappings": {
    "properties": {
        "cid" : {
          "type" : "long"
        },
        "cityName" : {
          "type" : "keyword"
        },
        "cityid" : {
          "type" : "short"
        },
        "content" : {
          "type" : "text",
          "search_analyzer": "notice_analyzer", 
          "analyzer" : "notice_analyzer"
        },
        "createDate" : {
          "type" : "long"
        },
        "did" : {
          "type" : "long"
        },
        "dname" : {
          "type" : "text",
          "analyzer" : "ik_smart"
         
        },
        "pid" : {
          "type" : "integer"
        },
        "pname" : {
          "type" : "keyword"
        },
        "tid" : {
          "type" : "long"
        },
        "title" : {
          "type" : "text",
          "analyzer" : "ik_smart"
        },
        "tname" : {
          "type" : "text",
          "analyzer" : "ik_smart"
        },
        "type" : {
          "type" : "short"
        },
        "dtype" : {
          "type" : "short"
        }
      }
  }
}
DELETE notice_record
PUT notice_record/
{
    "settings": {
    "analysis": {
      "analyzer": {
        "notice_analyzer":{
          "char_filter":["html_strip"],
          "tokenizer":"ik_max_word"
        }
      }
    },"number_of_shards": 1,
    "number_of_replicas": 1
  },
"mappings" : {
      "properties" : {
        "areaName" : {
          "type" : "keyword"
        },
        "areaid" : {
          "type" : "short"
        },
        "cityName" : {
          "type" : "keyword"
        },
        "cityid" : {
          "type" : "short"
        },
        "pid" : {
          "type" : "short"
        },
        "pname" : {
          "type" : "keyword"
        },
        "content" : {
          "type" : "text",
          "analyzer" : "notice_analyzer",
          "search_analyzer" : "ik_max_word"
        },
        "createDate" : {
          "type" : "long"
        },
        "dealer" : {
          "type" : "nested",
          "include_in_parent" : true,
          "properties" : {
            "did" : {
              "type" : "long"
            },
            "name" : {
              "type" : "text",
              "search_analyzer" : "ik_smart",
              "analyzer" : "ik_smart"
            },
            "type" : {
              "type" : "short"
            },
            "dtype" : {
              "type" : "short"
            }
          }
        },
        "id" : {
          "type" : "long"
        },
        "title" : {
          "type" : "text",
           "search_analyzer" : "ik_smart",
          "analyzer" : "ik_smart"
        }
      }
    }
  
}


GET notice_info_new/_search
{
  "query": {
    "terms": {
      "content": [
        "疼痛科",
        "麻醉机",
        "简易呼吸器",
        "喉镜",
        "气管内导管",
        "氧气面罩",
        "多功能生命监测仪",
        "经皮神经肌电刺激仪",
        "经皮热电除痛仪",
        "超短波治疗气户离子透入治疗仪",
        "镇痛注射包",
        "硬膜外腔置管包",
        "硬膜外腔穿剌包",
        "床头牵引器",
        "颈围",
        "腰围",
        "神经射频治疗系统",
        "激光治疗系统",
        "臭氧治疗系统"
      ]
    }
  },
  "aggs": {
    "tids": {
      "terms": {
        "field": "tid",
        "size": 1000
      },
      "aggs": {
        "keywords": {
          "terms": {
            "field": "content",
            "size": 10,
            "include": [
              "臭氧治疗系统",
              "激光治疗系统"
            ]
          }
        }
      }
    }
  },
  "size": 0
}

 

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
0 评论
0 收藏
0
分享
AI总结
返回顶部
顶部