# Search xpack users

**URL:** <https://discuss.elastic.co/t/search-xpack-users/115698>\
**Category:** Elasticsearch\
**Created:** [January 16, 2018, 11:32am UTC](https://discuss.elastic.co/t/search-xpack-users/115698 "2018-01-16T11:32:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jchannon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jchannon/32/23280_2.png) [@jchannon](https://discuss.elastic.co/u/jchannon)\
**Post date:** [January 16, 2018, 11:32am UTC](https://discuss.elastic.co/t/search-xpack-users/115698/1 "2018-01-16T11:32:30Z")

</div>

I can't use `POST /_xpack/security/user/_search {}` as that thinks I'm trying to add a new user.

What is the API to search users?

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [January 16, 2018, 11:49am UTC](https://discuss.elastic.co/t/search-xpack-users/115698/2 "2018-01-16T11:49:00Z")

</div>

There is no API for searching.

You can retrieve all users with `GET /_xpack/security/user`  
or retrieve users by username `GET /_xpack/security/user/jacknich,rdinero`

- [https://www.elastic.co/guide/en/elasticsearch/reference/6.1/security-api-users.html](https://www.elastic.co/guide/en/elasticsearch/reference/6.1/security-api-users.html)

---

<div class="post-metadata">

**Author:** ![jchannon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jchannon/32/23280_2.png) [@jchannon](https://discuss.elastic.co/u/jchannon)\
**Post date:** [January 16, 2018, 11:52am UTC](https://discuss.elastic.co/t/search-xpack-users/115698/3 "2018-01-16T11:52:36Z")

</div>

Does that mean I can't search user metadata?

I'm reading [this](https://www.elastic.co/blog/attribute-based-access-control-with-xpack) and trying to test the search for metadata before applying a role query template

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [January 16, 2018, 12:09pm UTC](https://discuss.elastic.co/t/search-xpack-users/115698/4 "2018-01-16T12:09:13Z")

</div>

> Does that mean I can't search user metadata?

It means you can't search for users with specific metadata.

I don't follow why you're trying to do that in the context of the ABAC post.

---

<div class="post-metadata">

**Author:** ![jchannon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jchannon/32/23280_2.png) [@jchannon](https://discuss.elastic.co/u/jchannon)\
**Post date:** [January 16, 2018, 12:11pm UTC](https://discuss.elastic.co/t/search-xpack-users/115698/5 "2018-01-16T12:11:01Z")

</div>

Just trying to see if I get the search query correct before adding it to the template. I've had lots of weird issues with syntax for the role template in the past.

---

<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 13, 2018, 12:14pm UTC](https://discuss.elastic.co/t/search-xpack-users/115698/6 "2018-02-13T12:14:49Z")

</div>

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