# How can we convert Splunk query into Elastic Query

**URL:** <https://discuss.elastic.co/t/how-can-we-convert-splunk-query-into-elastic-query/259075>\
**Category:** Elasticsearch\
**Created:** [December 18, 2020, 9:12am UTC](https://discuss.elastic.co/t/how-can-we-convert-splunk-query-into-elastic-query/259075 "2020-12-18T09:12:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sajal](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@Sajal](https://discuss.elastic.co/u/Sajal)\
**Post date:** [December 18, 2020, 9:12am UTC](https://discuss.elastic.co/t/how-can-we-convert-splunk-query-into-elastic-query/259075/1 "2020-12-18T09:12:38Z")

</div>

Hi Folks,

Can you please help me to convert below splunk query into elastic query ?  
It has single index and we need to put two time ranges on similar field(ChannelSessionId) and calculate percentage in both counts.

index=digital sourcetype=channel-services EntryExitLog GwpValidateTransactionInfo earliest=-245m latest=-5m  
| stats dc(ChannelSessionId) as CWC by ChannelErrorCode  
| join type=outer ChannelErrorCode  
[ search index=digitalsourcetype=channel-services EntryExitLog GwpValidateTransactionInfo earliest=-20405m latest=-20165m  
| stats dc(ChannelSessionId) as LFC by ChannelErrorCode]  
| fillnull value=0  
| eval deviation=round(((CWC-LFC)\*100/LFC),0)

Thanks  
Sajal

---

<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:** [January 15, 2021, 9:12am UTC](https://discuss.elastic.co/t/how-can-we-convert-splunk-query-into-elastic-query/259075/2 "2021-01-15T09:12:53Z")

</div>

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