How to get count of search , where year=2019 and "start_date"="end_date". Please guide me how can this be done in java.
You can may be use a painless script to solve the field equality part but that will be slow.
If this is something you intend to do a lot of time, I'd recommend computing at index time something like a duration field for example.
Then it will be easy to find documents in 2019 where duration is 0.