ES数据库一些问题记录

1、ES数据库数据迁移

资料链接: https://cloud.tencent.com/developer/article/1145944

npm下载:https://developer.aliyun.com/mirror/NPM?from=tnpm

工具:elasticsearch-dump

碰到问题nodejs版本过低:

解决问题:https://blog.csdn.net/p243679396/article/details/106200715

https://blog.csdn.net/z15802933724/article/details/82346776

升级node.js到最新稳定版:n stable

 

es数据更新字段

es_client = Elasticsearch(hosts=['172.18.8.118:9200', '172.18.8.118:9201', '172.18.8.118:9202'])
    query = {'query': {'match_all': {}}, "size":10000}
    res = es_client.search(index="local_faq", body=query)
    
    print("size:", len(res['hits']['hits']))
    for idx, hit in enumerate(res["hits"]["hits"]):
        question = hit["_source"]["question"]
        print(idx, question)
        a = get_vector(question)
        a = eval(a)
        es_client.update(index='local_faq', doc_type='_doc', id=hit['_id'], body={"doc":{"question_vector": a}})

 

es添加新字段

curl -H "Content-Type: application/json" -XPUT http://172.18.8.118:9200/local_faq/_mapping/ -d '{
  "properties": {
       "question_vector": {
          "type": "dense_vector",
          "dims": 300
       }
   }
}'

 

es 查看某个索引下数据总量

https://www.zhihu.com/question/322366935/answer/674441677

GET http://172.18.8.35:9200/index_name/_count

返回:
{
  "count": 3939,
  "_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  }
}

 

ES数据库操作指南

https://www.elastic.co/guide/cn/elasticsearch/guide/current/shingles.html#shingles

es数据库更改已有字段的数据类型

https://blog.csdn.net/apple9005/article/details/90415558

1、删除原来index时,记得重新创造,然后在使用第5步,

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值