pip install elasticsearch python from elasticsearch import Elasticsearch es = Elasticsearch([{'host': 'localhost', 'port': 9200}]) python doc = { 'author': 'John Doe', 'text': 'Elasticsearch-py tutorial', 'timestamp': datetime.now(), } res = es.index(index='test-index', id=1, body=doc) python res = es.search(index='test-index', body={'query': {'match': {'text': 'elasticsearch'}}})


上一篇:
下一篇:
切换中文