# How to call lock APIs using call with request

**URL:** <https://discuss.elastic.co/t/how-to-call-lock-apis-using-call-with-request/199026>\
**Category:** Kibana\
**Created:** [September 11, 2019, 7:20am UTC](https://discuss.elastic.co/t/how-to-call-lock-apis-using-call-with-request/199026 "2019-09-11T07:20:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![adityaPsl](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@adityaPsl](https://discuss.elastic.co/u/adityaPsl)\
**Post date:** [September 11, 2019, 7:20am UTC](https://discuss.elastic.co/t/how-to-call-lock-apis-using-call-with-request/199026/1 "2019-09-11T07:20:45Z")

</div>

Hello Team,  
Could you please help me understand how can we call lock create/ delete APIs using callwithrequest.  
For example  
PUT /FS/lock/\<index\_name\>/\_create

DELETE /FS/lock/\<index\_name\>/

I'm referring to the [Solving Concurrency Issues](https://www.elastic.co/guide/en/elasticsearch/guide/current/concurrency-solutions.html#document-locking)

Thanks for your help and support.

Thank you,  
Aditya

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [September 11, 2019, 12:05pm UTC](https://discuss.elastic.co/t/how-to-call-lock-apis-using-call-with-request/199026/2 "2019-09-11T12:05:06Z")

</div>

This is more of a Elasticsearch question. What is your exact question ?  
Instead of locking the whole filesystem, we could lock individual documents by using the same technique. Am moving this to ES forum so that folks from that team can give you more detailed answer.

Thanks  
Rashmi

---

<div class="post-metadata">

**Author:** ![adityaPsl](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@adityaPsl](https://discuss.elastic.co/u/adityaPsl)\
**Post date:** [September 11, 2019, 12:38pm UTC](https://discuss.elastic.co/t/how-to-call-lock-apis-using-call-with-request/199026/3 "2019-09-11T12:38:10Z")

</div>

Hello Rashmi,

I want to lock index and I got the APIs to achieve that, the problem I am facing here is I am using callwithrequest client in Kibana custom visualisation, so just wanted to understand how can we execute these APIs from JavaScript using callwithrequest client.

Kibana version : 6.7  
Moving it back to Kibana.

Thank you,  
Aditya

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [September 12, 2019, 11:04pm UTC](https://discuss.elastic.co/t/how-to-call-lock-apis-using-call-with-request/199026/4 "2019-09-12T23:04:19Z")

</div>

You could try using `transport.request`, which allows you full control over the URL, query, and params:

```auto
      return callWithRequest(req, 'transport.request', {
        path: '/lock/{index}/_create',
        method: 'PUT',
        query,
        body
      });

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 10, 2019, 11:04pm UTC](https://discuss.elastic.co/t/how-to-call-lock-apis-using-call-with-request/199026/5 "2019-10-10T23:04:19Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
