# Primary-replica shard location

**URL:** <https://discuss.elastic.co/t/primary-replica-shard-location/10867>\
**Category:** Elasticsearch\
**Created:** [February 24, 2013, 2:16pm UTC](https://discuss.elastic.co/t/primary-replica-shard-location/10867 "2013-02-24T14:16:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ophir\_Michaeli](https://avatars.discourse-cdn.com/v4/letter/o/9f8e36/32.png) [@Ophir\_Michaeli](https://discuss.elastic.co/u/Ophir_Michaeli)\
**Post date:** [February 24, 2013, 2:16pm UTC](https://discuss.elastic.co/t/primary-replica-shard-location/10867/1 "2013-02-24T14:16:54Z")

</div>

Hi,

How can I know if a certain node has the primary or replica shard?  
I'm doing tests with the forced awareness settings and need to know if it  
works.

Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [February 24, 2013, 4:20pm UTC](https://discuss.elastic.co/t/primary-replica-shard-location/10867/2 "2013-02-24T16:20:05Z")

</div>

The Indice Status API[http://www.elasticsearch.org/guide/reference/api/admin-indices-status.html](http://www.elasticsearch.org/guide/reference/api/admin-indices-status.html)is what you are looking for:

{  
"ok": true,  
"\_shards": {  
"total": 2,  
"successful": 2,  
"failed": 0  
},  
"indices": {  
"test": {

```
           [...]

     "shards": {
        "0": [
           {
              "routing": {
                 "state": "STARTED",
                 "primary": true,
                 "node": "sLz81D7QSr-rdlqr8lAGKA",
                 "relocating_node": null,
                 "shard": 0,
                 "index": "test"
              }, 
       
         [...]

```

On Sunday, February 24, 2013 9:16:54 AM UTC-5, Ophir Michaeli wrote:

> Hi,
> 
> How can I know if a certain node has the primary or replica shard?  
> I'm doing tests with the forced awareness settings and need to know if it  
> works.
> 
> Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![drewr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drewr/32/7803_2.png) [@drewr](https://discuss.elastic.co/u/drewr)\
**Post date:** [February 25, 2013, 1:18am UTC](https://discuss.elastic.co/t/primary-replica-shard-location/10867/3 "2013-02-25T01:18:26Z")

</div>

Ophir Michaeli wrote:

> How can I know if a certain node has the primary or replica shard?  
> I'm doing tests with the forced awareness settings and need to know  
> if it works.

Try this:

% curl -s [download.elasticsearch.org/es2unix/es](http://download.elasticsearch.org/es2unix/es) \>es; chmod +x es  
% ./es shards

The output is easier to parse visually than json. From  
[GitHub - elastic/es2unix: Command-line ES](https://github.com/elasticsearch/es2unix).

-Drew

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 2:49am UTC](https://discuss.elastic.co/t/primary-replica-shard-location/10867/4 "2017-07-06T02:49:47Z")

</div>


