当前位置:网站首页>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
边栏推荐
- 软件测试 -- 1 软件测试知识大纲梳理
- Examples of bio, NiO, AIO
- The input input box of H5 page pops up the numeric keypad, which needs to support decimal points
- Gateway reports an error service_ UNAVAILABLE
- Save the image with gaussdb (for redis), and the recommended business can easily reduce the cost by 60%
- ~4.2 CCF 2021-12-1 sequence query
- 网络安全应急响应技术实战指南(奇安信)
- 【cartographer_ros】八: 官方Demo参数配置和效果
- Idea regular expression replacement (idea regular search)
- sudo rosdep init Error ROS安装问题解决方案
猜你喜欢

swiper 一侧或两侧露出一小部分

How to design a high concurrency system?

【MySQL必知必会】触发器 | 权限管理

Mysql表的操作

微信公众号正式环境上线部署,第三方公众平台接入
![[eloquence] negotiation persuasion skills and Strategies](/img/01/0fcbbfcf35a6d166c14ba4215eacac.jpg)
[eloquence] negotiation persuasion skills and Strategies

sqli-labs Basic Challenges Less11-22

English语法_不定代词 - other / another

English grammar_ Indefinite pronoun - other / other

Teach you how to apply for SSL certificate
随机推荐
Huawei ENSP router static route (the next hop address of the default route)
实现一个家庭安防与环境监测系统(二)
Two Sum
元器件采购系统的主要功能,数字化采购助力元器件企业飞速发展
DVWA practice - brute force cracking
软件测试 -- 1 软件测试知识大纲梳理
Apple failed to synchronize on its mobile terminal, and logged out. As a result, it could not log in again
基于redis的keys、scan删除ttl为-1的key
牛客多校 E G J L
安防市场进入万亿时代,安防B2B网上商城平台精准对接深化企业发展路径
English语法_不定代词 - other / another
GameFramework制作游戏(二)制作UI界面
Gateway reports an error service_ UNAVAILABLE
Development of uni app offline ID card identification plug-in based on paddleocr
sqli-labs Basic Challenges Less11-22
实现一个家庭安防与环境监测系统(一)
idea正则表达式替换(idea正则搜索)
Goldfish rhca memoirs: cl210 management storage -- object storage
Cologne new energy IPO was terminated: the advanced manufacturing and Zhanxin fund to be raised is the shareholder
MySQL 45讲 | 06 全局锁和表锁 :给表加个字段怎么有这么多阻碍?