# CSV Lookup error

**URL:** <https://community.graylog.org/t/csv-lookup-error/17255>\
**Category:** Graylog Central (peer support)\
**Tags:** pipeline-rules\
**Created:** [September 22, 2020, 11:27am UTC](https://community.graylog.org/t/csv-lookup-error/17255 "2020-09-22T11:27:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gianluca-valentini](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/gianluca-valentini/32/1592_2.png) [@gianluca-valentini](https://community.graylog.org/u/gianluca-valentini)\
**Post date:** [September 22, 2020, 11:27am UTC](https://community.graylog.org/t/csv-lookup-error/17255/1 "2020-09-22T11:27:16Z")

</div>

Hi all,  
I’m using csv lookup to enrich the email domain.  
I created a DataAdapter that use a already present csv file, the Cache and the Lookup Table too

 ![image](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/4/41faa3f4ab98d1404e1c78c3c5c69b6911cd3b5c.png)  
where I add a default single value when the domain is not present in the csv file.

Here a snippet of my pipeline rule:

```
let domain = lookup_value("email-freemail-domains", to_string($message.email_source_domain));
  
  set_field("public_src_domain", domain);

```

Now I have this problem on Graylog:  
If I use the **lookup** function in my pipeline rule, the message is prenset but is present in this way:  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/8/8404df90bb0604ca16e9c9258828b33d5c4b3e8c.png)

While my expected value should be just 1. So I throught that the result is a map and I update the code using **domain[“value”]** in my rule but no messages arrive!

If I use **lookup\_value** no messages are present on Graylog stream and there is an error on the graylog log:

`WARN : org.graylog2.indexer.messages.Messages - Failed to index message: index=<graylog_3> id=<858d0570-fcc5-11ea-9410-c2dd6581dc42> error=<{"type":"mapper_parsing_exception","reason":"object mapping for [public_src_domain] tried to parse field [public_src_domain] as object, but found a concrete value"}>`

This is the same message that I have if I use **lookup** and **domain[“value”]**  
So what does this error message means?  
How I can complete my scenario, where am I doing wrong?

---

<div class="post-metadata">

**Author:** ![shoothub](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/shoothub/32/6412_2.png) [@shoothub](https://community.graylog.org/u/shoothub)\
**Post date:** [September 22, 2020, 11:59am UTC](https://community.graylog.org/t/csv-lookup-error/17255/2 "2020-09-22T11:59:24Z")

</div>

1. Try to use custom mapping for field, or use new field name. After create custom mappping rotate index.
2. Alternatively you can also save value as number using  
`set_field("public_src_domain", to_long(domain));`

---

<div class="post-metadata">

**Author:** ![gianluca-valentini](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/gianluca-valentini/32/1592_2.png) [@gianluca-valentini](https://community.graylog.org/u/gianluca-valentini)\
**Post date:** [September 22, 2020, 12:49pm UTC](https://community.graylog.org/t/csv-lookup-error/17255/3 "2020-09-22T12:49:38Z")

</div>

Hi @shoothub  
Changing the field name it works…but I are very surprised about this workaround

---

<div class="post-metadata">

**Author:** ![shoothub](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/shoothub/32/6412_2.png) [@shoothub](https://community.graylog.org/u/shoothub)\
**Post date:** [September 22, 2020, 12:55pm UTC](https://community.graylog.org/t/csv-lookup-error/17255/4 "2020-09-22T12:55:25Z")

</div>

It’s a way how Elastic Search works. It will try to guess format of data (dynamic mapping) and assign it to the field first time it was saved. Then if you try to save another type of data it won’t work. You can only save one data type, for example if you create field with numeric value, you can’t insert string value afterwards.

> **[Elasticsearch — Graylog 3.3.2 documentation](https://docs.graylog.org/en/3.3/pages/configuration/elasticsearch.html#custom-index-mappings)**

---

<div class="post-metadata">

**Author:** ![gianluca-valentini](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/gianluca-valentini/32/1592_2.png) [@gianluca-valentini](https://community.graylog.org/u/gianluca-valentini)\
**Post date:** [September 22, 2020, 2:09pm UTC](https://community.graylog.org/t/csv-lookup-error/17255/5 "2020-09-22T14:09:20Z")

</div>

Hi @shoothub  
thanks a lot for your clarification 😃

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/3X/c/7/c7c09c6b5099570133d6502b83f50ba4430de5b6.png) [@system](https://community.graylog.org/u/system)\
**Post date:** [October 6, 2020, 2:09pm UTC](https://community.graylog.org/t/csv-lookup-error/17255/6 "2020-10-06T14:09:26Z")

</div>

Closed on October 6, 2020, 2:09pm UTC

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