Hello, please, I am looking for guidance on how to perform a simple search. I have the following set of data:
POST /processing_records/_bulk
{"index":{}}
{"processing_id":"1234","file_name":"file1.xls","start_processing":"06/07/2024","status_processing":"processing"}
{"index":{}}
{"processing_id":"1234","file_name":"file1.xls","start_processing":"06/07/2024","end_processing":"06/07/2024","status_processing":"processed"}
{"index":{}}
{"processing_id":"1235","file_name":"file2.xls","start_processing":"06/07/2024","status_processing":"processing"}
{"index":{}}
{"processing_id":"1235","file_name":"file2.xls","start_processing":"06/07/2024","end_processing":"06/07/2024","status_processing":"processed"}
{"index":{}}
{"processing_id":"1236","file_name":"file2.xls","start_processing":"06/07/2024","status_processing":"processing"}
{"index":{}}
{"processing_id":"1236","file_name":"file2.xls","start_processing":"06/07/2024","end_processing":"06/07/2024","status_processing":"processed"}
{"index":{}}
{"processing_id":"1237","file_name":"file4.xls","start_processing":"06/07/2024","status_processing":"processing"}
if helps, the set of data would look like this in CSV
processing_id, file_name, start_processing, end_processing, status_processing
1234, file1.xls, 06/jul/2024, empty, processing
1234, file1.xls, 06/jul/2024, 06/jul/2024, processed
1235, file2.xls, 06/jul/2024, empty, processing
1235, file2.xls, 06/jul/2024, 06/jul/2024, processed
1236, file2.xls, 06/jul/2024, empty, processing
1236, file2.xls, 06/jul/2024, 06/jul/2024, processed
1237, file4.xls, 06/jul/2024, empty, processing
as you can see the same processing id will appear twice, once when is processing and a second when is processed, in this case and in this given moment, only the record 1237 is still processing and is not processed.
in a SQL form, in order to find this record i would run something like this:
SELECT * FROM processing_records
WHERE status_processing = 'processing' AND
processing_id not IN (SELECT processing_id FROM processing_records WHERE status_processing = 'processed' )
I tried a few ways to get this done in DSL as the example below, however it is not working,
I also tried to SQL convert using the APIs but again this is not supported.
Any advices?
Thanks in advance