Do you need to create the data view via an API? You can use the data view creation screen in Kibana, or alternatively create the data view using the create API.
I don't know if I need alias and filter. But I want a Data View with name App1 and it contains logs from 2 specific hosts. Sorry if I'm not clear enough.
Using a query filter in the same way you were doing in the first post, but you need to check if the filters is correct with a query and to target the data stream, not a backing indice.
The main question is, what is the reason behind of creating a filtered data view?
I would say that it is a bad approach because you may end up with a lot of data views, which can add confusion.
Also, Dashboards and Security Rules are created based on the data view, so you may need duplicate dashboards and security rules if you are going to use them.
It is way more common to just filter by the hosts you want on Discover or Dashboard, be it by adding a filter on the moment you are using or by using a saved search in discover with the filter already saved.
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.