# How to create a 2d array of string in painless?

**URL:** https://discuss.elastic.co/t/how-to-create-a-2d-array-of-string-in-painless/140803
**Category:** Elasticsearch
**Created:** [July 19, 2018, 7:53pm UTC](https://discuss.elastic.co/t/how-to-create-a-2d-array-of-string-in-painless/140803 "2018-07-19T19:53:27Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![praveendhawan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/praveendhawan/32/33545_2.png) [@praveendhawan](https://discuss.elastic.co/u/praveendhawan)
#### Post date: [July 19, 2018, 7:53pm UTC](https://discuss.elastic.co/t/how-to-create-a-2d-array-of-string-in-painless/140803/1 "2018-07-19T19:53:28Z")

</div>

I want to create a 2-d array of String data type in painless.  
I have tried several versions but all of them are giving me error.

`String[][] myArray = {{'abc', 'pqr'}, {'xzy', 'ljk'}}`  
`String[][] myArray = new String[][] {{'abc', 'pqr'}, {'xzy', 'ljk'}}`  
`myArray = {{'abc', 'pqr'}, {'xzy', 'ljk'}}`

The error I am getting is - `invalid sequence of tokens near...`

For 1st case, it's near `['[']`  
For 2nd case, it's near `['[']`  
For 3rd, it's near `['{']`

I am using Elastic Version - 6.1

---

<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: [August 16, 2018, 7:53pm UTC](https://discuss.elastic.co/t/how-to-create-a-2d-array-of-string-in-painless/140803/2 "2018-08-16T19:53:28Z")

</div>

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