最近的项目需用到ElasticSearch,啃了官网文档和ElasticSearch源码;终于理清楚了,Mark一下.
通过python 代码 检索 ElasticSearch
# -*- coding: utf-8 -*-
from elasticsearch import Elasticsearch
search_body ={
"query": {
"match": {
"field": "text"
}
},
"from": 0,
"size": 10,
"sort": [
{ "field": "desc" }
]
}
search_index = "搜索索引"
es = Elasticsearch(['ip:port'], http_auth=('用户名', '密码'), timeout=3600)
result = es.search(index=search_index, body=search_body)
print (result )
通过Jmeter 检索 ElasticSearch
-
新增HTTP信息头管理器
-
HTTP授权管理器
-
HTTP请求默认值
-
HTTP请求