# Sort by array values

**URL:** <https://discuss.elastic.co/t/sort-by-array-values/274681>\
**Category:** Elasticsearch\
**Created:** [June 1, 2021, 7:29pm UTC](https://discuss.elastic.co/t/sort-by-array-values/274681 "2021-06-01T19:29:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![romina](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/romina/32/79705_2.png) [@romina](https://discuss.elastic.co/u/romina)\
**Post date:** [June 1, 2021, 7:29pm UTC](https://discuss.elastic.co/t/sort-by-array-values/274681/1 "2021-06-01T19:29:36Z")

</div>

Hi! I need help with this use case

Documents

```auto
    {
    "values": ["value1", "value3"],
    "price": 3
    } 
    {
    "values": ["value1", "value2", "value3"],
    "price": 1
    }
    {
    "values": ["value3"],
    "price": 17
    }
    {
    "values": ["value1", "value3"],
    "price": 10
    }
    {
    "values": ["value2", "value3"],
    "price": 15
    }

```

I need to sort these documents by a value and then by price

for example: all with "value1" first

```auto
    {
    "values": ["value1", "value2", "value3"],
    "price": 1
    }
    {
    "values": ["value1", "value3"],
    "price": 3
    } 
    {
    "values": ["value1", "value3"],
    "price": 10
    }
    {
    "values": ["value2", "value3"],
    "price": 15
    }
    {
    "values": ["value3"],
    "price": 17
    }

```

It is possible?  
thanks!! 🙂

---

<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:** [June 29, 2021, 7:30pm UTC](https://discuss.elastic.co/t/sort-by-array-values/274681/2 "2021-06-29T19:30:07Z")

</div>

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