Is there a way to just post a command using the low level or nest .net clients?

I dont see an appropriate category or tags for either of those .net clients, and the GitHub repo for them says to ask questions here, so sorry if this is the wrong category.

I need to create an index mapping with some analyzers. I have built the string with the command and can paste it into Kibana and it works fine, but this needs to be something that runs programmatically and (as usual) I cant find the way to do that using the helper API things like Indicies. I thought there was a way to just send an arbitrary command to elastic using the low level client a few years ago, but I dont see it in the 7.10.0 packages. I want to do it this way because I already have the working statement being built correctly as a string, and because I dont have the time or desire to re-familiarize with all the crazy fluent nonsense.


You can use the low-level client. You can either depend solely on Elasticsearch.Net and create a new ElasticLowLevelClient or access it via the NEST client.

Once you have the low-level client you can send/receive raw string or byte content directly.

using Elasticsearch.Net;
using Nest;
using System.Threading.Tasks;

namespace Example
    class Program
        static async Task Main(string[] args)
            // Create a new low level client from `Elasticsearch.Net` package.

            var lowLevel = new Elasticsearch.Net.ElasticLowLevelClient();

            // OR from the high-level client

            var client = new ElasticClient();
            var response = await client.LowLevel.Indices.CreateAsync<StringResponse>("index-name", PostData.String("the JSON to post"));


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.