python from elasticsearch import Elasticsearch es = Elasticsearch([{'host': 'localhost', 'port': 9200}]) python es.indices.create(index='my_index', ignore=400) python es.index(index='my_index', id=1, body={'title': 'Python Elasticsearch', 'content': 'Elasticsearch is awesome!'}) python res = es.search(index='my_index', body={'query': {'match': {'title': 'Python'}}}) python es.indices.close(index='my_index') es.indices.put_settings(index='my_index', body={'index': {'analysis': {'analyzer': {'my_analyzer': {'type': 'custom', 'tokenizer': 'standard'}}}}}) es.indices.open(index='my_index') $ pip install elasticsearch python from elasticsearch import Elasticsearch python es = Elasticsearch([{'host': 'localhost', 'port': 9200}]) python es.indices.create(index='my_index', ignore=400) python es.index(index='my_index', id=1, body={'title': 'Python Elasticsearch', 'content': 'Elasticsearch is awesome!'}) python res = es.search(index='my_index', body={'query': {'match': {'title': 'Python'}}}) python es.indices.close(index='my_index') es.indices.put_settings(index='my_index', body={'index': {'analysis': {'analyzer': {'my_analyzer': {'type': 'custom', 'tokenizer': 'standard'}}}}}) es.indices.open(index='my_index')


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