The method of recording management indexes #
from elasticsearch Import elasticsearch
ES = elasticsearch ([ 'xx.xx.xx.xx: 9200'])
# obtaining document content
res = es.get_source (index = "test ", id = '- R7AQ20BIdlTveXFPOTI' )
Print (RES)
# get the document information
RES = es.get (index = "the Test", the above mentioned id = '- R7AQ20BIdlTveXFPOTI')
Print (RES [ '_ Source'])
# updated documentation
res = es.update (index = "test ", ID = '- R7AQ20BIdlTveXFPOTI', body = {" DOC ": {" Age ": 37 [," Country ":" China "}})
Print (RES)
# whether there is an index
print (es.indices.exists (index = "the Test"))
# delete a document
Print (es.delete (index = "the Test", the above mentioned id = "- h7AQ20BIdlTveXFeOSg"))
# multiple data query
res = es.mget (index = "test ",= {body 'IDS': [ ". 1", "-R7AQ20BIdlTveXFPOTI"]})
Print (RES)
#index Create Index
res = es.index(index="school", body = {
'mappings': {
'_source': {
'enabled': True
},
'properties': {
'content': {'type': 'keyword'}
}
}
})
print(res)
elasticsearch python using conventional methods (Index)
Guess you like
Origin www.cnblogs.com/loveyouyou616/p/11573044.html
Recommended
Ranking