Each id can belong to different types (which are dates here). The aim is to get documents matching given id list having minimum value of _type.
So for an input of id=[1,2], documents 1 & 3 should be returned as they have minimum value of _type (2017-01-01).
This can easily be done on per id basis (by querying for min available type for a given id), but that'd be too expensive as the given id list is in range of thousands.
You could use field collapsing (https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-collapse.html) to do this but note that we don't allow multiple types per index in the latest versions of es. Instead of multiple types, you could use a field to register the date for the document (_type in your example) and use another field to handle _id which does not seem to be an id in your case since multiple documents can have the same id.
With field collapsing you could do:
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.