Thanks for your question!
I want to merge and sort the results of multiple indexes.
It is possible to do a search query in multiple indices, but you would have to merge them and sort them from your own front-end as the engine doesn’t support this kind of queries.
In your case, as you are doing the same search in both indices, and sorting them according to the same criteria, I would recommend having only one index for both that could look like this:
"title": "posts title1",
"title": "posts title2",
And then you can sort it by date: https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/sort-an-index-by-date/. Note that to be properly sorted, dates have to be stored in the UNIX timestamp format. In order not to override the relevance ranking strategy for this index, I would also advise to apply this sorting criteria in a replica index.
You can still display posts and comments separately in different sections of your website by applying a filter on the “type” attribute.
In case you still want to do a multi-index search, you can setup an instantsearch instance for each of your indices, and then hook them to the same search box with the aid of a helper:
like explained in the docs here: https://www.algolia.com/doc/guides/building-search-ui/resources/ui-and-ux-patterns/in-depth/multi-index-search/js/
and implemented in this JS Fiddle: https://jsfiddle.net/j9nwpz34/27/.
I hope this helps!
Let us know how it goes and if you have more questions.