# How to save search filter automatically using CURL command

**URL:** <https://discuss.elastic.co/t/how-to-save-search-filter-automatically-using-curl-command/115591>\
**Category:** Kibana\
**Created:** [January 15, 2018, 7:04pm UTC](https://discuss.elastic.co/t/how-to-save-search-filter-automatically-using-curl-command/115591 "2018-01-15T19:04:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashokkrishna99\_Vemur](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@ashokkrishna99\_Vemur](https://discuss.elastic.co/u/ashokkrishna99_Vemur)\
**Post date:** [January 15, 2018, 7:04pm UTC](https://discuss.elastic.co/t/how-to-save-search-filter-automatically-using-curl-command/115591/1 "2018-01-15T19:04:28Z")

</div>

Hi,

When i'm trying to save a search filter i'm getting the error. Please find the below output.

```
[root@example ~]# curl -XPUT http://localhost:9200/.kibana/search/http-response-200 -d '{"_id": "523c22b0-fa06-11e7-9220-ab1ecb28a04f","_type": "search","_source": {"title": "http-response-200","description": "","hits": 0,"columns": ["_source"],"sort": ["@timestamp","desc"],"version": 1,"kibanaSavedObjectMeta": {"searchSourceJSON": "{\"index\":\"packetbeat-*\",\"highlightAll\":true,\"version\":true,\"query\":{\"query_string\":{\"query\":\"http.response.code: 200\",\"analyze_wildcard\":true}},\"filter\":[]}"}}}'
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Field [_id] is a metadata field and cannot be added inside a document. Use the index API request parameters."}],"type":"mapper_parsing_exception","reason":"Field [_id] is a metadata field and cannot be added inside a document. Use the index API request parameters."},"status":400}
```

---

<div class="post-metadata">

**Author:** ![spalger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spalger/32/14092_2.png) [@spalger](https://discuss.elastic.co/u/spalger)\
**Post date:** [January 16, 2018, 8:38pm UTC](https://discuss.elastic.co/t/how-to-save-search-filter-automatically-using-curl-command/115591/2 "2018-01-16T20:38:36Z")

</div>

Error message is pretty self explanatory if you ask me, "Field [\_id] is a metadata field and cannot be added inside a document. Use the index API request parameters.".

Your request needs to look like this instead:

```auto
curl -XPUT "http://localhost:9200/.kibana/search/http-response-200" -d '{
  "title": "http-response-200",
  "description": "",
  "hits": 0,
  "columns": ["_source"],
  "sort": ["@timestamp","desc"],
  "version": 1,
  "kibanaSavedObjectMeta": {"searchSourceJSON": "{\"index\":\"packetbeat-*\",\"highlightAll\":true,\"version\":true,\"query\":{\"query_string\":{\"query\":\"http.response.code: 200\",\"analyze_wildcard\":true}},\"filter\":[]}"}
}'

```

---

<div class="post-metadata">

**Author:** ![ashokkrishna99\_Vemur](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@ashokkrishna99\_Vemur](https://discuss.elastic.co/u/ashokkrishna99_Vemur)\
**Post date:** [January 18, 2018, 2:05am UTC](https://discuss.elastic.co/t/how-to-save-search-filter-automatically-using-curl-command/115591/3 "2018-01-18T02:05:53Z")

</div>

Thank you.  
Its working.

Can you also tell me how to save this search filter as visualization filer.

---

<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:** [February 15, 2018, 2:05am UTC](https://discuss.elastic.co/t/how-to-save-search-filter-automatically-using-curl-command/115591/4 "2018-02-15T02:05:58Z")

</div>

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