{
    "runtime_mappings": {
        "process_duration": {
            "type": "double",
            "script": {
                "source": "if (!doc['9.cid'].empty) {emit(doc['9.processTime'].value);} else if (doc['8.position'].empty) {if (!doc['5.timestamp'].empty) {long duration = doc['5.timestamp'].value.toInstant().toEpochMilli() - doc['0.timestamp'].value.toInstant().toEpochMilli();emit(duration );} else if (!doc['7.timestamp'].empty) {long duration = doc['7.timestamp'].value.toInstant().toEpochMilli() - doc['0.timestamp'].value.toInstant().toEpochMilli();emit(duration );} else if (!doc['4.timestamp'].empty) {long duration = doc['4.timestamp'].value.toInstant().toEpochMilli() - doc['0.timestamp'].value.toInstant().toEpochMilli();emit(duration );} else {emit(0.0);} } else {emit(0.0);}"
            }
        }
    },
    "query": {
        "bool": {
            "filter": [
                {
                    "range": {
                        "process_duration": {
                            "gt": 600000.0
                        }
                    }
                },
                {
                    "exists": {
                        "field": "0.timestamp"
                    }
                },
                {
                    "range": {
                        "0.timestamp": {
                            "from": "2026-01-01 00:00:00.000",
                            "to": "2026-01-22 12:30:40.000"
                        }
                    }
                }
            ]
        }
    },
    "fields": [
        "0.operationCode",
        "0.timestamp",
        "1.timestamp",
        "2.timestamp",
        "3.timestamp",
        "4.timestamp",
        "6.timestamp",
        "5.timestamp",
        "7.timestamp",
        "8.timestamp",
        "9.timestamp"
    ],
    "_source": false,
    "size": 10000
}