AWS Elasticsearch Direct Access via RestClient

Wrote up some of the answers to your questions below, but I’m now thinking this is not an issue with hibernate search (so feel free to not read the rest!). I did try performing a GET to with a URI of / from the rest client and I was able to obtain the ES info. And in hindsight, I really should have been tipped off by the response from my _msearch POST. That response was HTML, which I don’t believe ES even deals with(it responds in JSON only AFAIK). So that tells me something else in the network is generating that response and am following up on that. Will probably close this issue in the next day or two pending resolution.

As for using fullTextQuery.getQueryString() - I don’t see that in my IDE as an auto-complete option. It’s not present in the interface but I do see now it’s available in the concrete impl org.hibernate.search.query.hibernate.impl.FullTextQueryImpl. Which I confirmed produces identical results. :thumbsup:

Below is the construction of the RestClient:

  private RestClient buildRestClient()
  {
    SearchFactory searchFactory = getFullTextEntityManager().getSearchFactory();
    IndexFamily indexFamily = searchFactory.getIndexFamily( ElasticsearchIndexFamilyType.get() );
    ElasticsearchIndexFamily elasticsearchIndexFamily = indexFamily.unwrap( ElasticsearchIndexFamily.class );
    return elasticsearchIndexFamily.getClient( RestClient.class );
  }

Lastly, on your question regarding the query - you are correct in that a Person can belong to 0-n groups and I must evaluate each group to return those that a Person is a member of. So I am kinda stuck with the _msearch method or the even less efficient DSL method of making a call-per-group. :frowning:

1 Like