es学习笔记

GET bg-knowledge/_search
{
  "query": {
    "match_all": {}
  }
}

GET bg-knowledge-tmp/_search
{
  "query": {
    "match_all": {}
  }
}


GET bg-knowledge-0704copy/_search
{
  "query": {
    "match_all": {}
  }
}

GET bg-knowledge/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "delFlag": "1"
          }
        },
        {
          "match": {
            "status": "2"
          }
        }
      ],
      "should": [
        {
          "match": {
            "name": "简介"
          }
        },{
          "match": {
            "comment": "简介"
          }
        }
      ],
      "minimum_should_match": 1
    }
    
  },
  "size": 110
}

//删除索引下所有数据
POST bg-knowledge-tmp/_delete_by_query
{
  "query": {"match_all": {}}
}



//获取映射
GET bg-knowledge-tmp/_mapping
GET bg-knowledge/_mapping



DELETE bg-knowledge





//新增索引
PUT bg-knowledge
{
    "settings": {
        "number_of_shards": "3",  
        "number_of_replicas": "1"  
    }
}



//修改映射
PUT bg-knowledge/_mapping
{
  "properties" : {
        "approveCount" : {
          "type" : "long"
        },
        "businessId" : {
          "type" : "long"
        },
        "categoryName" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "categoryPath" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "level2Name" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "categoryType" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "collectionCount" : {
          "type" : "long"
        },
        "comment" : {
          "type" : "text",
          "analyzer": "ik_max_word"
        },
        "createBy" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "createTime" : {
          "type" : "date",
          "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||yyyy-MM-dd HH:mm:ss.SSS||yyyy-MM-dd'T'HH:mm:ss.SSS Z||epoch_millis"
        },
        "delFlag" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "docStatus" : {
          "type" : "long"
        },
        "docValidity" : {
          "type" : "date"
        },
        "downloadCount" : {
          "type" : "long"
        },
        "fileSuffixList" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "fileSuffixs" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "firstAuditUser" : {
          "properties" : {
            "firstAuditAccount" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "firstAuditDeptId" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "firstAuditName" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            }
          }
        },
        "followCount" : {
          "type" : "long"
        },
        "level2path" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "name" : {
          "type" : "text",
          "analyzer": "ik_max_word"
        },
        "readCount" : {
          "type" : "long"
        },
        "count" : {
          "type" : "long"
        },
        "secondAuditUser" : {
          "properties" : {
            "secondAuditAccount" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "secondAuditDeptId" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "secondAuditName" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            }
          }
        },
        "status" : {
          "type" : "long"
        },
        "tagList" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "tags" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "type" : {
          "type" : "long"
        },
        "updateBy" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "updateTime" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "uploadUser" : {
          "properties" : {
            "uploadAccount" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "uploadDeptId" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "uploadName" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            }
          }
        }
      }
}



//复制数据
POST _reindex
{
  "source": {
    "index": "bg-knowledge-tmp"  
  },
  "dest": {
    "index": "bg-knowledge" 
    
  }
}


// 设置最大查询
PUT bg-knowledge/_settings
{

    "index":{
       "max_result_window":1000000
    }

}



// 查看分词

POST bg-knowledge/_analyze
{
  "analyzer": "ik_max_word",
  "text": "联通数字科技有限公司简介—公司整体介绍"
}

POST bg-knowledge/_analyze
{
  "analyzer": "ik_smart",
  "text": "联通数字科技有限公司简介—公司整体介绍"
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值