# 배열 타입의 속성을 배열의 길이로 정렬하는 방법

**URL:** <https://discuss.elastic.co/t/topic/122289>\
**Category:** 한국어 질문 및 토론\
**Created:** [March 2, 2018, 3:46pm UTC](https://discuss.elastic.co/t/topic/122289 "2018-03-02T15:46:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![6f99472dfa6144929fc4](https://avatars.discourse-cdn.com/v4/letter/6/edb3f5/32.png) [@6f99472dfa6144929fc4](https://discuss.elastic.co/u/6f99472dfa6144929fc4)\
**Post date:** [March 2, 2018, 3:46pm UTC](https://discuss.elastic.co/t/topic/122289/1 "2018-03-02T15:46:18Z")

</div>

안녕하세요.  
엘라스틱 6.x 버전을 이용해서 개발하면서 정렬의 대한 문제가 있어서 질문드립니다.  
배열 값이 들어가 있는 "meta\_likecnt"의 배열 길이값으로 정렬된 값을 가져오는 방법을 찾아봤는데 아래와 같은 소스를 이용해서 정렬을 시도 해 보았으나 원하는 결과값이 나오지 않았습니다.

```auto
{ "sort": { "_script": { "script": "doc['meta_likecnt'].values.size()" } } }

```

아래는 현재 생성되어 있는 구조입니다. 어떤 부분에서 놓친거나 잘못된 부분이 있는지 알려주시면 감사합니다ㅠ  
ㅠ

```auto
{
  "settings" : {
    "index":{
      "analysis":{
        "analyzer":{
          "korean":{
            "type":"custom",
            "tokenizer":"seunjeon_default_tokenizer"
          }
        },
        "tokenizer": {
          "seunjeon_default_tokenizer": {
            "type": "seunjeon_tokenizer"
          }
        }
      }
    }
  },
  "mappings": {
    "tb_meta": {
      "properties": {
        "meta_crtuser": { "type": "keyword" },
        "meta_crtdate": { "type": "keyword" },
        "meta_altdate": { "type": "date" },
        "meta_altuser": { "type": "keyword" },
"meta_title": { "type": "text", "analyzer": "korean" },
        "meta_description": { "type": "text", "analyzer": "korean" },
    		"meta_likecnt": { "type": "text" },
    		"meta_unlikecnt": { "type": "text" },
      }
    }
  }
}

```

---

<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:** [March 30, 2018, 3:46pm UTC](https://discuss.elastic.co/t/topic/122289/2 "2018-03-30T15:46:31Z")

</div>

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