I am trying to use the Nest client to consume an Elasticsearch instance.
However, the /_search endpoint is in fact /search .
Is there any possible way to change the behavior of the client to reflect this change?
I have tried looking into the source code but just can't figure out a way this can be done.
Disclaimer: I have no control over the ES instance, neither I know if there is some sort of proxy in the middle that alters the /_search into /search .
I guess this is a "protected" environment of elasticsearch, where only some endpoints are available. I assume they only allow the search route, which is basically _search rewritten to search.
I'm trying to grab more information from the provider.
The version is 6.2.3.
It seems that the /transcripts/search endpoint is not a "true" elasticsearch endpoint, but combines multiple information into one single endpoint. For example, while the transcript is a valid Type, originally does not contain all the information that is returned in this endpoint.
Am I out of luck in using the NEST Client, even if I somehow can get them to make /_search available?
It does! I answered this same question on Stack Overflow:
I'll include it here for completeness.
/search is not an API endpoint in Elasticsearch. It is not possible to change the API endpoints within the client, without changing the API specs from which it is generated and recompiling.
You can use the low level client's DoRequest and DoRequestAsync methods to call
a non-standard API.
With the 6.x or 7.x client (you should use the 6.x client with 6.2.3)
var client = new ElasticClient();
var request = new SearchRequest<LogMessage>
{
Query = new MatchQuery
{
Field = Infer.Field<LogMessage>(f => f.Level),
Query = "warning"
}
};
var response = client.LowLevel.DoRequest<SearchResponse<LogMessage>>(
Elasticsearch.Net.HttpMethod.POST,
"/search",
PostData.Serializable<ISearchRequest>(request)
);
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.