# Need help with data merge in Vega

**URL:** <https://discuss.elastic.co/t/need-help-with-data-merge-in-vega/192278>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [July 25, 2019, 3:28pm UTC](https://discuss.elastic.co/t/need-help-with-data-merge-in-vega/192278 "2019-07-25T15:28:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sokoloves](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@sokoloves](https://discuss.elastic.co/u/sokoloves)\
**Post date:** [July 25, 2019, 3:28pm UTC](https://discuss.elastic.co/t/need-help-with-data-merge-in-vega/192278/1 "2019-07-25T15:28:43Z")

</div>

Hello,  
I'm trying to merge data into a hard-coded y-axis and I need to connect Y axis names to multiple keys, I'll this part of code so you can get a better understanding:

```
  "name": "some_name",
  "values": [
    {"a": "name1", "c": "key1"},
    {"a": "name2", "c": "key2"},
    {"a": "name3", "c": "key3"},
  ],
  "transform": [
     {
      "type": "lookup",
      "from": "my_data",
      "key": "original_key",
      "fields": ["c"],
      "values": ["some_value"]

```

Now some additional info about my data: the "original\_key" field I'm getting from my\_data has multiple string values (key1,key2,key3....keyN) which are connected to integer values in "some\_value". My main goal is to get name1 to obtain data from more than key1, as well as name2 and name3 I want them to get data from more than 1 key as well. In the end I'm trying to achieve something like that :

```
 "name": "some_name",
  "values": [
    {"a": "name1", "c": ["key1","key12"]},
    {"a": "name2", "c": ["key2","key22","key31"]},
    {"a": "name3", "c": ["key3","key7","key8","key9","key14"]},
  ],
  "transform": [
     {
      "type": "lookup",
      "from": "my_data",
      "key": "original_key",
      "fields": ["c"],
      "values": ["some_value"]

```

I also tried this:

```
  "name": "some_name",
  "values": [
    {"a": "name1", "c": "key1"},
    {"a": "name1", "c": "key12"},
    {"a": "name2", "c": "key2"},
    {"a": "name2", "c": "key22"},
    {"a": "name3", "c": "key3"},
    {"a": "name3", "c": "key33"},
    {"a": "name3", "c": "key19"},
  ],
  "transform": [
     {
      "type": "lookup",
      "from": "my_data",
      "key": "original_key",
      "fields": ["c"],
      "values": ["some_value"]

```

But it did not work and data for each name where there were more than 1 key value just went on top of each other.  
Sorry for my poor explanations, I will try to answer any questions, thank you

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [July 25, 2019, 5:26pm UTC](https://discuss.elastic.co/t/need-help-with-data-merge-in-vega/192278/2 "2019-07-25T17:26:21Z")

</div>

@nyuriks - can u please help here ?

Thanks  
Rashmi

---

<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 22, 2019, 5:26pm UTC](https://discuss.elastic.co/t/need-help-with-data-merge-in-vega/192278/3 "2019-08-22T17:26:29Z")

</div>

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