python3 업데이트 및 삭제elasticsearch 및 삭제es 인덱스

from elasticsearch import Elasticsearch

es_client = Elasticsearch(["localhost:9200"])

//  
delete_options ={"query":{
                         "bool":{
                         "must":[{"term":{"alert_level":"critical"}},
                         {"range":{
                         "write_date":{
                         "gte":"2018-11-11",
                        "lte":"now"
                        }
                                                      }
                                                      }
                                                    ]
                                                }
                                                }
                                                }

//  id 
delete_by_id = {"query":{"match":{"_id":"_Yon72YBncOSVgrNpmU6"}}}
//  
delete_by_all = {"query":{"match_all":{}}}
result = es_client.delete_by_query(index="index_name", body=delete_by_id, doc_type="vulnerability")
print(result)
#  
es_client.update(index="sapiens_ids_compare", doc_type="vulnerability", id="id ", body={"doc": {"is_linked": 0}})

es_client.indices.flush()
#  
es_client.indices.delete('log_index')

좋은 웹페이지 즐겨찾기