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步,