#记录管理索引等方法

from elasticsearch import Elasticsearch

es = Elasticsearch(['xx.xx.xx.xx:9200'])

#获取文档内容
res = es.get_source(index="test", id='-R7AQ20BIdlTveXFPOTI')
print(res)

#获取文档信息
res = es.get(index="test", id='-R7AQ20BIdlTveXFPOTI')
print(res['_source'])

#更新文档
res = es.update(index="test", id='-R7AQ20BIdlTveXFPOTI', body={"doc": {"age": 37, "country": "china"}})
print(res)

#索引是否存在
print(es.indices.exists(index="test"))

#删除文档
print(es.delete(index="test", , body = {
'mappings': {
'_source': {
'enabled': True
},
'properties': {
'content': {'type': 'keyword'}
}
}
})
print(res)

相关文章:

  • 2021-11-22
  • 2021-08-24
  • 2021-12-29
  • 2021-07-17
  • 2021-10-23
猜你喜欢
  • 2022-01-30
  • 2021-06-07
  • 2021-08-01
  • 2022-01-19
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案