How Logstash sync work?

I am new to Elasticsearch and Logstash, I want to know how Logstash can Sync data with Elasticsearch, for example, what mechanism does Logstash have to recognize a changed data field or just scan the entire database every time it is scheduled?