Pass Data to Elasticsearch from a Remote Server

I have two PCs. Assueme that they are Server1 and Server2.
Logstash is installed in Server2 and Elasticsearch is configured in Server1. I want to send filtered logstash data from Server2 to Server1.
Which configurations shall I do?
(please give me some example configuaration file of .conf file, Logstash.yml, Elasticsearch.yml)

Please take a look at the Getting Started With Logstash documentation along with the Getting started with the Elastic Stack docs.

All the volunteers in this forum are happy to assist when you run into problems, but please take the time to read the documentation before letting others write your configuration, so you can provide some context what is not working as expected.

See also https://www.elastic.co/help

Thank you!