# Unable To Split Json Array in Elasticsearch Query Response

**URL:** <https://discuss.elastic.co/t/unable-to-split-json-array-in-elasticsearch-query-response/199009>\
**Category:** Logstash\
**Created:** [September 11, 2019, 5:29am UTC](https://discuss.elastic.co/t/unable-to-split-json-array-in-elasticsearch-query-response/199009 "2019-09-11T05:29:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rameshkokare1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rameshkokare1/32/55902_2.png) [@rameshkokare1](https://discuss.elastic.co/u/rameshkokare1)\
**Post date:** [September 11, 2019, 5:29am UTC](https://discuss.elastic.co/t/unable-to-split-json-array-in-elasticsearch-query-response/199009/1 "2019-09-11T05:29:32Z")

</div>

Hi,  
Not able to parse brand filed from below response. Logstash taking requests on port 31315  
via http input plugin  
json to be parsed:

# { "took": 2, "timed\_out": false, "\_shards": { "total": 1, "successful": 1, "skipped": 0, "failed": 0 }, "hits": { "total": { "value": 1, "relation": "eq" }, "max\_score": 11.48834, "hits": [{ "\_index": "rjilrepo", "\_type": "\_doc", "\_id": "91150500", "\_score": 11.48834, "\_source": { "brand": "LYF", "model": "LS-5015", "@timestamp": "2019-08-29T13:42:56.723Z", "TAC": "91150500", "DATA\_GPRS": "1", "jiolte": "true", "jiovolte": "true", "os": "Android", "deviceType": "Smartphone", "2G": "true", "3G": "true", "4G": "true", "UICC.Sim Type": "MicroNano" } }] } }

My Logstash Code below  
input {  
http {  
host =\> "10.144.20.56"  
port =\> 31315  
codec =\> "json"

```
            }

```

}

filter {  
json { source =\> "message" }

split {  
field =\> "hits"  
}

mutate {  
add\_field =\> {  
"LocalizationId" =\> "%{[hits][total][value]}"  
"Rel" =\> "%{[hits][total][relation]}"  
"brand" =\> "%{[hits][hits][\_source][brand]}"  
}  
remove\_field =\> ["[message]" ]  
}  
}

output {  
file {  
path =\> "/tmp/apicall.log"  
}

```
  exec {command => "echo %{LocalizationId} %{Rel} %{brand} > /tmp/fffff"}

```

}

Thnks in advance...

---

<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:** [October 9, 2019, 5:29am UTC](https://discuss.elastic.co/t/unable-to-split-json-array-in-elasticsearch-query-response/199009/2 "2019-10-09T05:29:37Z")

</div>

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