当前位置:网站首页>Kibana operation es
Kibana operation es
2022-07-25 14:34:00 【You are like a sweet Yida】
List of articles
es On
es website
kibana operation es
Elaticsearch, Referred to as es, Yes es The operation is based on REST Style operation ;
The basic operations are :PUT( establish , modify ) POST( establish , modify ) DELETE( Delete ) GET( Inquire about ) POST( Inquire about ) ; We usually do the most additions, deletions, modifications and checks ; Query is the most important and complex .
What I posted can be copied directly to kibana Inside , Then you can create more data by yourself , You can make your own according to the query .
Simple operation
# obtain ElasticSearch A lot of current information !
GET _cat/
GET /_cat/plugins
## participle
GET _analyze
{
"analyzer": "ik_smart",
"text": " Young people don't speak martial arts "
}
GET _analyze
{
"analyzer": "ik_max_word",
"text": " Young people don't speak martial arts "
}
# Create index , Cannot modify after creation
PUT /test1
{
"mappings": {
"properties": {
"name":{
"type": "text"
},
"age":{
"type": "long"
},
"birthday":{
"type": "date"
},
"tag":{
"type": "text"
}
}
}
}
# Get index information
GET test1
## Delete index
DELETE test1
# The new document Appoint id, Follow random id
PUT /test1/_doc/1
{
"name":" Zhang Yida ",
"age":11,
"birthday": "1990-08-09"
}
POST /test1/_doc/
{
"name":" Zhang Yida ",
"age":11,
"birthday": "1990-08-09"
}
# Modify the document
# put Cover ,_version Meeting +1 If not, it will be empty ( Don't suggest , Fields will be lost , Unless you really want to cover it all )
PUT /test1/_doc/1
{
"name" : " Zhang Yida ",
"age" : 183
}
GET /test1/_doc/1
# post _update Suggest ,_version unchanged ( Suggest , Be careful doc Field )
POST /test1/_update/1/
{
"doc": {
"name" : " Zhang Yida 2"
}
}
GET /test1/_doc/1
Query operation
Query basic operations
## Inquire about
## Deprecation: [types removal] Specifying types in search requests is deprecated. Will let you delete type,_doc
GET /test1/_doc/_search?q=name: benefit
GET /test1/_search?q=name: benefit
GET /test1/_search?q=age:11
## Query match
##match: matching ( Can use word segmentation to parse ( First analyze the document , And then query ))
## term: Specify terms directly through inverted index , Accurate query , No participle , Suitable field types are number,date,keyword, Not suitable for text
##_source: Filter fields
##sort: Sort
##form、size Pagination
GET /test1/_search
{
"query": {
"match": {
"name": " Zhang "
}
}
,
"_source": ["name","age"],
"sort": [
{
"age": {
"order": "asc"
}
}
],
"from": 1
,
"size": 1
}
# Multiconditional query
#must amount to and
#should amount to or
#must_not amount to not (... and ...)
#filter Filter
GET /test1/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"name": "1"
}
},
{
"match": {
"age": "1"
}
}
],
"filter": [
{
"range": {
"age": {
"gte": 1,
"lte": 2
}
}
}
]
}
}
}
# Create an index with an array , If the index does not exist, it will be created automatically
POST /test_arr/_doc
{
"name" : " Zhang Yida 2",
"age" : 18,
"birthday":"1990-09-08",
"tag":[" The lawyer "," Funny "," self-confidence "]
}
POST /test_arr/_doc
{
"name" : " Zhang Yida 3",
"age" : 18,
"birthday":"1990-09-08",
"tag":[" The lawyer " ," male "]
}
GET /test_arr/_doc/1
GET /test_arr/_search
{
"query": {
"match": {
"tag": " male t "
}
}
}
# match Can use word segmentation to parse ( First analyze the document , And then query )
GET /test_arr/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"name": " Zhang "
}
},
{
"match": {
"tag": " Male lawyers are funny, female confident people "
}
}
]
}
}
}
# term Accurate query
GET /test1/_search
{
"query": {
"term": {
"age": 1
}
}
}
text and keyword
- text:
Support participle , Full text search 、 Support ambiguity 、 Precise query , Aggregation is not supported , The sorting operation ;
text The maximum supported character length of type is unlimited , Suitable for large field storage ; - keyword:
No participle , Direct index 、 Support ambiguity 、 Support exact match , Support aggregation 、 The sorting operation .
keyword The maximum supported length of a type is ——32766 individual UTF-8 Type of characters , Can be set by ignore_above Specify self-contained character length , Data beyond a given length will not be indexed , Unable to get term Exact matching search results return .
## test keyword and text Whether word segmentation is supported
PUT /test
{
"mappings": {
"properties": {
"text":{
"type":"text"
},
"keyword":{
"type":"keyword"
}
}
}
}
PUT /test/_doc/1
{
"text":" test keyword and text Whether word segmentation is supported ",
"keyword":" test keyword and text Whether word segmentation is supported "
}
# text Support participle
# keyword Participle... Is not supported
# Find out
GET /test/_doc/_search
{
"query":{
"match":{
"text":" test "
}
}
}
## We can't find it
GET /test/_doc/_search
{
"query":{
"match":{
"keyword":" test "
}
}
}
# Word segmentation analysis
GET _analyze
{
"analyzer": "keyword",
"text": [" test liu"]
}
GET _analyze
{
"analyzer": "standard",
"text": [" test liu"]
}
GET _analyze
{
"analyzer":"ik_max_word",
"text": [" test liu"]
}
Highlight query
## Highlight query , The main thing is to add prefix and suffix to the content of the query
GET test1/_doc/_search
{
"query": {
"match": {
"name":" Zhang "
}
}
,
"highlight": {
"pre_tags": "<p class='key' style='color:red'>",
"post_tags": "</p>",
"fields": {
"name": {
}
}
}
}
thus kibana operation es Some common operations of , See the official documents for more details :
https://www.elastic.co/guide/cn/elasticsearch/guide/current/full-body-search.html
The next section uses java Code operation es
边栏推荐
- The main function of component procurement system, digital procurement helps component enterprises develop rapidly
- Typora cannot open the prompt to install a new version solution
- 应用实践:Paddle分类模型大集成者[PaddleHub、Finetune、prompt]
- Structure size
- pt100测温电路图(ad590典型的测温电路)
- [eloquence] negotiation persuasion skills and Strategies
- opencv视频跟踪「建议收藏」
- Digital Twins - cognition
- Reverse Integer
- 基于redis的keys、scan删除ttl为-1的key
猜你喜欢

sqli-labs Basic Challenges Less1-10

Development of uni app offline ID card identification plug-in based on paddleocr

Idea settings ignore file configuration when submitting SVN
Famous handwritten note taking software recruit CTO · coordinate Shenzhen

Deep understanding of pytorch distributed parallel processing tool DDP -- starting from bugs in engineering practice

Save the image with gaussdb (for redis), and the recommended business can easily reduce the cost by 60%

VS2017大型工厂ERP管理系统源码 工厂通用ERP源码

Under the epidemic, the biomedical industry may usher in breakthrough development

From fish eye to look around to multi task King bombing -- a review of Valeo's classic articles on visual depth estimation (from fisheyedistancenet to omnidet) (Part 2)

Teach you how to apply for SSL certificate
随机推荐
变分(Calculus of variations)的概念及运算规则
实现一个家庭安防与环境监测系统(一)
awk从入门到入土(24)提取指令网卡的ip
Realize a family security and environmental monitoring system (I)
jqgrid全选取消单行点击取消事件
应用实践:Paddle分类模型大集成者[PaddleHub、Finetune、prompt]
51单片机学习笔记(2)
The concept and operation rules of calculus of variations
idea正则表达式替换(idea正则搜索)
PHP website design ideas
The main function of component procurement system, digital procurement helps component enterprises develop rapidly
基于PaddleOCR开发uni-app离线身份证识别插件
Practical guide for network security emergency response technology (Qianxin)
Products on Apple's official website can save 600 yuan by buying iPhone 13 Pro max at a discount
Why do China Construction and China Railway need this certificate? What is the reason?
Thymeleaf setting disabled
Writing standard of physical quantities and unit symbols
D2. picking carrots (hard version) (one question per day)
Mysql表的操作
Wechat official account official environment online deployment, third-party public platform access