import os
def save_version(file_path):
version = 1
while True:
new_file = f"{file_path}.v{version}"
if not os.path.exists(new_file):
break
version += 1
with open(file_path, 'rb') as original, open(new_file, 'wb') as new_version:
new_version.write(original.read())
return new_file
]]>
PUT /documents
{
"mappings": {
"properties": {
"content": {
"type": "text"
}
}
}
}
]]>
POST /documents/_doc/1
{
"content": "这是一个测试文档,用于演示全文搜索功能。"
}
]]>
GET /documents/_search
{
"query": {
"match": {
"content": "测试文档"
}
}
}
]]>
本站知识库部分内容及素材来源于互联网,如有侵权,联系必删!