# Mutate multiple fields from multiple tables

**URL:** https://discuss.elastic.co/t/mutate-multiple-fields-from-multiple-tables/122775
**Category:** Logstash
**Created:** [March 6, 2018, 7:52pm UTC](https://discuss.elastic.co/t/mutate-multiple-fields-from-multiple-tables/122775 "2018-03-06T19:52:49Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![jurquiza](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@jurquiza](https://discuss.elastic.co/u/jurquiza)
#### Post date: [March 6, 2018, 7:52pm UTC](https://discuss.elastic.co/t/mutate-multiple-fields-from-multiple-tables/122775/1 "2018-03-06T19:52:49Z")

</div>

Hi everyone!

After some time of fighting with logstash i managed to insert my sql server database to elastic. Im having some trouble when im emitting a field that looks like a phone number(a field with a "-" character) but its in fact and id...logstash reads it as a date field and send me errors(cause its out of a year range) . My question is the following...Is there a way to mutate a field from an specific table withing some nested tables?  
My code is the following:  
input{  
jdbc{ one for each table in my DB)  
}  
}  
filter{  
mutate{  
{ convert statement here to string  
}  
}  
output{ }

Please be kind im a nooblord 😅

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [March 8, 2018, 7:24pm UTC](https://discuss.elastic.co/t/mutate-multiple-fields-from-multiple-tables/122775/2 "2018-03-08T19:24:13Z")

</div>

It's Elasticsearch that (in this case incorrectly) autodetects the string as a date. To avoid this you need to explicitly set mappings, typically via an index template, that maps that field as a string.

---

<div class="post-metadata">

### Author: ![jurquiza](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@jurquiza](https://discuss.elastic.co/u/jurquiza)
#### Post date: [March 12, 2018, 4:01pm UTC](https://discuss.elastic.co/t/mutate-multiple-fields-from-multiple-tables/122775/3 "2018-03-12T16:01:29Z")

</div>

Magnus,

Thanks for the reply! i manage to correct this issue. I ´m currently establishing a database from ms sql to elastic and i was wondering if there´s a way to apply mutate filters to several tables from my db in the conf file of logstash, and if there is one, whats the syntax to achieve it?. Thank you in advance!!

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [March 12, 2018, 9:18pm UTC](https://discuss.elastic.co/t/mutate-multiple-fields-from-multiple-tables/122775/4 "2018-03-12T21:18:41Z")

</div>

It's not clear what you want to achieve. "Tables" don't exist in the realm of Logstash and Elasticsearch and filters are applied to individual documents, which correspond to rows in a result set of a database query. If you could give an example of the kind of transforms you want to apply it would be possible to give a more specific answer.

---

<div class="post-metadata">

### Author: ![jurquiza](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@jurquiza](https://discuss.elastic.co/u/jurquiza)
#### Post date: [April 9, 2018, 1:59pm UTC](https://discuss.elastic.co/t/mutate-multiple-fields-from-multiple-tables/122775/5 "2018-04-09T13:59:32Z")

</div>

thanks! was able to fix it by adding multiple "mutate"

---

<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: [May 7, 2018, 1:59pm UTC](https://discuss.elastic.co/t/mutate-multiple-fields-from-multiple-tables/122775/6 "2018-05-07T13:59:39Z")

</div>

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