# Parse output of elasticsearch-py commands

**URL:** <https://discuss.elastic.co/t/parse-output-of-elasticsearch-py-commands/275879>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [June 14, 2021, 5:43pm UTC](https://discuss.elastic.co/t/parse-output-of-elasticsearch-py-commands/275879 "2021-06-14T17:43:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tp20165](https://avatars.discourse-cdn.com/v4/letter/t/a5b964/32.png) [@tp20165](https://discuss.elastic.co/u/tp20165)\
**Post date:** [June 14, 2021, 5:43pm UTC](https://discuss.elastic.co/t/parse-output-of-elasticsearch-py-commands/275879/1 "2021-06-14T17:43:13Z")

</div>

I am writing on alerting functionality in Python using elasticsearch-py client. [https://github.com/elastic/elasticserch-py](https://github.com/elastic/elasticserch-py). CatClient class has methods that I am interested in. I can see the output as stdout when I run my python code, however I want to parse the output and extract some details that I want. How do I do it? Is there any parameters that I can pass to get the output as list or json?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [June 21, 2021, 8:27am UTC](https://discuss.elastic.co/t/parse-output-of-elasticsearch-py-commands/275879/2 "2021-06-21T08:27:49Z")

</div>

try `format=json` for the cat API. However you could also use the dedicated JSON APIs depending what data you are after.

---

<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:** [July 19, 2021, 8:28am UTC](https://discuss.elastic.co/t/parse-output-of-elasticsearch-py-commands/275879/3 "2021-07-19T08:28:32Z")

</div>

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