# Replace value with another value

**URL:** <https://discuss.elastic.co/t/replace-value-with-another-value/253741>\
**Category:** Logstash\
**Created:** [October 29, 2020, 6:44pm UTC](https://discuss.elastic.co/t/replace-value-with-another-value/253741 "2020-10-29T18:44:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![errupeshmca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/errupeshmca/32/78285_2.png) [@errupeshmca](https://discuss.elastic.co/u/errupeshmca)\
**Post date:** [October 29, 2020, 6:44pm UTC](https://discuss.elastic.co/t/replace-value-with-another-value/253741/1 "2020-10-29T18:44:06Z")

</div>

Hi,

Below is my code to replace one value with another value, i have True and false value in field Order completed ? ,  
and i want to replace true with Total order shipped and false with total order Pending.

But when you create a visualization in kibana it gives the value of "Order complete?" as well, i dont, want that to be visible in visualization.

mutate {convert =\> ["Order Complete?", "boolean"]}  
if [Order Complete?] =~ "True" {  
mutate {  
replace =\> { "Order Complete?" =\> "Total Order Shipped" }  
}  
}

if [Order Complete?] =~ "False" {  
mutate {  
replace =\> { "Order Complete?" =\> "Total Order Pending" }  
}  
}

Can you help me?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [October 29, 2020, 7:03pm UTC](https://discuss.elastic.co/t/replace-value-with-another-value/253741/2 "2020-10-29T19:03:19Z")

</div>

I would be surprised if those conditionals work. If [Order Complete?] is a boolean why not do

```
if [Order Complete?] {
    mutate { replace => { "Order Complete?" => "Total Order Shipped" } }
} else {
    mutate { replace => { "Order Complete?" => "Total Order Pending" } }
}
```

---

<div class="post-metadata">

**Author:** ![errupeshmca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/errupeshmca/32/78285_2.png) [@errupeshmca](https://discuss.elastic.co/u/errupeshmca)\
**Post date:** [November 2, 2020, 4:55pm UTC](https://discuss.elastic.co/t/replace-value-with-another-value/253741/3 "2020-11-02T16:55:11Z")

</div>

Thats works, Thanks a lot.

---

<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:** [November 30, 2020, 4:55pm UTC](https://discuss.elastic.co/t/replace-value-with-another-value/253741/4 "2020-11-30T16:55:42Z")

</div>

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