# Find out if started transaction successfully ended with painless script in elastic search

**URL:** <https://discuss.elastic.co/t/find-out-if-started-transaction-successfully-ended-with-painless-script-in-elastic-search/161693>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [December 20, 2018, 12:23pm UTC](https://discuss.elastic.co/t/find-out-if-started-transaction-successfully-ended-with-painless-script-in-elastic-search/161693 "2018-12-20T12:23:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sanjeev7](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@Sanjeev7](https://discuss.elastic.co/u/Sanjeev7)\
**Post date:** [December 20, 2018, 12:23pm UTC](https://discuss.elastic.co/t/find-out-if-started-transaction-successfully-ended-with-painless-script-in-elastic-search/161693/1 "2018-12-20T12:23:37Z")

</div>

i have below requirement not sure if its possible with painless please help me its very urgent  
requirement  
Please find below log response .  
in response json if we have txnname (published ) , txnNum and txnstatus . how to identify the count of completed and incomplete.  
completed :- for same txnnum if i found the status received and processed  
incomplete :- if txn started with status received but not found any match for same txn with status processed

{  
"took": 40,  
"timed\_out": false,  
"\_shards": {  
"total": 5,  
"successful": 5,  
"skipped": 0,  
"failed": 0  
},  
"hits": {  
"total": 77733,  
"max\_score": 1,  
"hits": [  
{  
"\_index": "testnew-ind-2018.12.18",  
"\_type": "doc",  
"\_id": "j75NwmcBZgQl9kZ2HhXY",  
"\_score": 1,  
"\_source": {  
"classname": "testclass",  
"Filter1": "108493602",  
"txnname": "published()",  
"beat": {  
"name": "test",  
"hostname": "testsysname",  
"version": "6.4.2"  
},  
"prospector": {  
"type": "log"  
},  
"input": {  
"type": "log"  
},  
"Timestamp": "2018-11-29 21:04:09",  
txnNum: "13851513416",  
"@timestamp": "2018-12-18T17:11:27.364Z",  
"possiblestatus": "possibleDuplicate = false",  
"@version": "1",  
"txnstatus": "received",  
"interfacenumber": "8",  
"fields": {  
"log\_type": "test-log-type"  
},  
"filter2": "txnInfo",  
"host": {  
"name": "testsysname"  
}  
}  
},  
{  
"\_index": "testnew-ind-2018.12.18",  
"\_type": "doc",  
"\_id": "mL5NwmcBZgQl9kZ2HhXY",  
"\_score": 1,  
"\_source": {  
"classname": "classname",  
"Filter1": "308745124",  
"txnname": "published()",  
"beat": {  
"name": "testsysname",  
"hostname": "testsysname",  
"version": "6.4.2"  
},  
"prospector": {  
"type": "log"  
},  
"input": {  
"type": "log"  
},  
"Timestamp": "2018-11-29 21:04:11",  
txnNum: "05830212552",  
"@timestamp": "2018-12-18T17:11:27.365Z",  
"LogLevel": "INFO ",  
"possiblestatus": "possibleDuplicate = false",  
"tags": [  
"beats\_input\_codec\_plain\_applied"  
],  
"@version": "1",  
"txnstatus": "processed",  
"interfacenumber": "6",  
"fields": {  
"log\_type": "test-log-type"  
},  
"filter2": "txnInfo",  
"host": {  
"name": "testsysname"  
}  
}  
},  
{  
"\_index": "testnew-ind-2018.12.18",  
"\_type": "doc",  
"\_id": "mL5NwmcBZgQl9kZ2HhXY",  
"\_score": 1,  
"\_source": {  
"classname": "classname",  
"Filter1": "308745124",  
"txnname": "published()",  
"beat": {  
"name": "testsysname",  
"hostname": "testsysname",  
"version": "6.4.2"  
},  
"prospector": {  
"type": "log"  
},  
"input": {  
"type": "log"  
},  
"Timestamp": "2018-11-29 21:04:11",  
txnNum: "13851513416",  
"@timestamp": "2018-12-18T17:11:27.365Z",  
"LogLevel": "INFO ",  
"possiblestatus": "possibleDuplicate = false",  
"tags": [  
"beats\_input\_codec\_plain\_applied"  
],  
"@version": "1",  
"txnstatus": "processed",  
"interfacenumber": "6",  
"fields": {  
"log\_type": "test-log-type"  
},  
"filter2": "txnInfo",  
"host": {  
"name": "testsysname"  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [December 20, 2018, 2:09pm UTC](https://discuss.elastic.co/t/find-out-if-started-transaction-successfully-ended-with-painless-script-in-elastic-search/161693/2 "2018-12-20T14:09:24Z")

</div>

See [entity centric indexing](https://twitter.com/elasticmark/status/1009380268409610240)

---

<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 17, 2019, 2:09pm UTC](https://discuss.elastic.co/t/find-out-if-started-transaction-successfully-ended-with-painless-script-in-elastic-search/161693/3 "2019-01-17T14:09:30Z")

</div>

Closed on January 17, 2019, 2:09pm UTC

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