(C#) NEST search using GET instead of POST?

(Brian Engel) #1


I'm wondering if someone knows how to make the ElasticSearch C# package (NEST) use the HTTP GET method instead of HTTP POST or if someone can point me in that direction.

I see from the source code that I need to somehow define a "source" on the QueryString, but I am unsure how to do so.

Basically I'm looking to end up with a search URI similar to:


The above looks like this after being sent via the default POST method using NEST:


  "from": 0,
  "size": 15,
  "query": {
    "query_string": {
      "query": "1000100721495",
      "fields": [
  "filter": {
    "range": {
      "timestamp": {
        "lte": "2016-06-12T23:59:00.000",
        "gte": "2015-06-10T00:00:00.000"

Is this even possible using NEST?


(Imran Siddique) #2

did you read this: http://nest.azurewebsites.net/nest/search/basics.html

(Brian Engel) #3

I did, however it doesn't mention that due to restrictions with how .NET operates all calls to the search method(s) will be done via POST instead of GET.

I did find a way around it but the method for doing so isn't listed within the documentation. I'm using the _source option for searching, but as a result of that I can no longer use NEST.

(system) #4