As you said, Solr and Elasticsearch are both built on top of the Apache Lucene project, so what's the difference and why would Magento deprecate support for Solr in favor of Elasticsearch?
First, if you're not familiar with these tools, they are open-source search engines. They support text search (think keywords typed into your search box) among other things. Honestly, these are serious search engines and if you are planning to manage either Solr or Elasticsearch yourself, you may want to try it first as these tools are significant pieces of infrastructure. That said, they are seriously powerful and can support more nuanced search scenarios than your default full-text search in a relational database like Postgres.
The feature set of Solr and Elasticsearch is, for practical purposes, identical. Solr really excels at some more advanced search problems and has a pretty natural extension framework. Elasticsearch favors a JSON/REST API approach rather than Solr's DSL-oriented interface (although Solr is releasing more JSON/REST APIs).
For differences, Elasticsearch is maybe a little easier to use out-of-the-box, but it's not a consumer product. In fact, the simple starting cases with Elasticsearch can lead to later difficulties for newbies who may not appreciate what they're getting into. For single server instances, I would say they're roughly equivalent.
As to why Magento is pushing Elasticsearch over Solr, I think Elasticsearch's JSON interface is a little easier to learn quickly, and its deployment story requires less operational skill than Solr.
In either case, if you're considering a different search engine for Magento you should consider some of the managed services for Elasticsearch (or Solr) rather than managing the servers yourself, as that is a whole skill in itself.
I think what you need is the SearchInterface of the Search Module.
Have a look at this post: Multiselect Filter in Magento 2 search Rest API
Basically, you see the filters and filter groups being build in the URL.
Then the webapi module does nothing less than executing the function Magento\Search\Api\SearchInterface::search()
with the filters and filter groups as search criteria.
So in your case, I think you can use the SearchInterface directly instead of the ProductRepository::getList()
function.
Best Answer
Give a try below to check atleast if ElasticSearch returns some results or not?
File: Check\Es\etc\di.xml
File: Check\Es\Plugin\ESResponseCheck.php
Clear the cache and catalog search reindexing
Perform any search terms and check var/debug.log file found in the Magento root directory.
In the debug.log file look for the product IDs returns from the ElasticSearch.
Also, check below URL for further info - https://magento.stackexchange.com/a/285358/34579