Reputation: 305
I am trying to run some performance tests on an ElasticSearch-backed JSON REST API, to try the impact of different filters on ElasticSearch.
I don't want to use the standard jmeter output, because there is too much clutter due to the over-the-wire time.
My API returns the time taken on ElasticSearch based on the took
(tookInMillis
in the java RestHighLevelClient we are using) property of the org.elasticsearch.action.search.SearchResponse
. This is returned in a time_taken
property of the API response.
This is a sample response
{
"page_size": 1,
"current_page": 1,
"number_of_pages": 2495,
"total_results": 2495,
"additional_results_exist": false,
"time_taken": 55,
"results": [
{
// object here, we don't really care
},
{
// object here, we don't really care
}
],
"request_id": "06e8001c-caf2-46f4-bf16-08c8d1ceb079"
}
So, the use case would be:
time_taken
property from the responsestime_taken
response property.I have found several references, mentioning JSON extractor, RegEx extactor, beanshell, but I didn't manage to get anything to work.
So, I would really appreciate a minimal working setup.
The jmeter version I am using is 5.4.3
Upvotes: 0
Views: 191
Reputation: 167992
We would really appreciate if you could provide the response from the ElasticSearch because we don't have any idea of how does it look like hence we cannot come up with a proper JSON Extractor setup.
I don't know what "time_taken" is, in Elastic Search it's called took
:
{
"took": 1, <--------------- I assume you want this value
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 0,
"relation": "eq"
},
"max_score": null,
"hits": [
]
}
}
If this is the case it can be obtained using JSON Extractor configured like:
If you want to utilize JMeter listeners you can create a "fake" sampler using i.e. Dummy Sampler where you can control response time:
This way the "fake" sampler will have response time from the took
ElasticSearch response JMeter will calculate the percentiles.
Demo:
Upvotes: 1