# Mocking ElasticSearch with Postman

**URL:** <https://community.postman.com/t/mocking-elasticsearch-with-postman/4651>\
**Category:** Help Hub\
**Tags:** tests, elastic, elasticsearch\
**Created:** [March 21, 2019, 5:20pm UTC](https://community.postman.com/t/mocking-elasticsearch-with-postman/4651 "2019-03-21T17:20:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zderan](https://avatars.discourse-cdn.com/v4/letter/z/f0a364/32.png) [@zderan](https://community.postman.com/u/zderan)\
**Post date:** [March 21, 2019, 5:20pm UTC](https://community.postman.com/t/mocking-elasticsearch-with-postman/4651/1 "2019-03-21T17:20:33Z")

</div>

Hi everyone,

I’m wondering if there is a way how to get a response from a postman mocked server based on the request body. I have read about matching algoritm how it works but still want to ask if there is some other possibility.

**Real life example:**  
I have a search service web api that generates a http requests to the ElasticSearch service. The search service is called from a client (e.g. user wants to find something in the material catalog). I want to ensure that the search service functionality wont be brake by anyone else so I’m using postman tests with postman mocking service.  
I made some test cases and saw what requests are firing to ElasticSearch so I can make a postman examples and create a mock server. However it is generating the same endpoint address for every call to ElasticSearch - it only differs in body request so I will get same response every time.  
I can’t use _x-mock-response-name_ since the request to the mocking server is happening outside of the postman tests.

I hope following illustration will help to imagine the situation.

 ![mock](https://us1.discourse-cdn.com/getpostman/original/3X/b/d/bdc1c49dfede448db35cdc4121d0dabeeb52b1cd.png)

Any help is greatly appriciated!
