檔案查詢
是否存在
HEAD articleeditstatisticsdev/_doc/36205410-31d4-44e5-ada2-3792cffdced9


查詢全部
GET quartz_system_202103/_search
{
"query": {
"match_all": {}
}
}
關鍵詞查詢
GET quartz_system_202103/_search
{
"query": {
"match": {
"doc.JobName": "商品串列"
}
}
}
分頁查詢
GET quartz_system_202103/_search
{
"query": {
"match_all": {}
},
"from": 0,
"size": 3
}
operator
and 分詞后都必須包含,or 包含其一就可以
GET quartz_system_202103/_search
{
"query": {
"match": {
"doc.JobName": {
"query": "獲取商品的串列",
"operator": "and"
}
}
}
}
GET quartz_system_202103/_search
{
"query": {
"match": {
"doc.JobName": {
"query": "獲取商品的串列1",
"operator": "or"
}
}
}
}
根據 ID
GET quartz_system_202103/_doc/542257d2-ef9f-4883-8e34-504257e6f651
多欄位查詢
POST quartz_system_202103/_search
{
"query": {
"multi_match": {
"query": "true",
"fields": ["doc.HttpOrDllRunIsSuccess","doc.HttpOrDllRunResultProcessIsSuccess"]
}
}
}
精確查詢 term
POST quartz_system_202103/_search
{
"query": {
"term": {
"doc.JobName": {
"value": "資料"
}
}
}
}
多值查詢 terms
POST quartz_system_202103/_search
{
"query": {
"terms": {
"doc.JobName": [
"資料",
"商品"
]
}
}
}
回傳需要欄位
GET quartz_system_202103/_search
{
"_source": ["doc.JobName","doc.HttpOrDllRunIsSuccess"],
"query": {
"match_all": {}
}
}
剔除不需要欄位
GET quartz_system_202103/_search
{
"_source": {
"excludes": ["doc.HttpOrDllRunResult","doc.timestamp"]
},
"query": {
"match_all": {}
}
}
檔案洗掉
根據 Id
DELETE quartz_system_202103/_doc/542257d2-ef9f-4883-8e34-504257e6f651
根據查詢條件
POST quartz_system_202103/_delete_by_query
{
"query":{
"match":{
"doc.JobName":"持倉_NZDUSD"
}
}
}
全部洗掉
POST quartz_system_202101/_delete_by_query
{
"query":{
"match_all":{}
}
}
檔案添加
POST user_web_info/_doc/_bulk
{ "create": {"_id": "1" }}
{"uuid":1,"name":"jack chen","nickname":"apple pear","age":20,"dt":"2016-06-25"}
{ "create": {"_id": "2" }}
{"uuid":2,"name":"jack ma","nickname":"apple pear pear","age":22,"dt":"2016-08-23"}
{ "create": {"_id": "3" }}
{"uuid":3,"name":"lucy","nickname":"apple pear apple","age":23,"dt":"2016-08-25"}

索引
是否存在
HEAD twitter
洗掉全部
DELETE /_all
or
DELETE /*
洗掉多個
DELETE /index_one,/index_two
創建索引
put /index_name
查看索引
GET /index_name
修改副本數
PUT /index_name/_settings
{
"number_of_replicas": 1
}
查看檔案數量
GET quartz_system_202104/_count

Mapping
創建索引 map
PUT user_web_info
{
"mappings": {
"properties": {
"uuid":{"type":"long"},
"name":{"type":"text","fields":{"keyword":{"type": "keyword"}}},
"nickname":{"type":"text"},
"age":{"type":"integer"},
"dt":{"type":"date","format": "yyyy-MM-dd"}
}
}
}

查看 map
GET /my_index/_mapping
添加 map 欄位
PUT /my_index/_mapping
{
"properties": {
"sex":{"type":"integer","index":false}
}
}
修改 map 欄位
對于已經存在的映射欄位,我們不能更新,更新必須創建新的索引進行資料遷移,

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/301466.html
標籤:其他
上一篇:[學習筆記]--資料庫系統
