Skip to content

Dispatching Index() from NEST into to Elasticsearch.NET failed #1833

@rdehuyss

Description

@rdehuyss

It's just a bit too late (past midnight CET+1) and I'm probably getting confused but I can't get the simplest example working. Below my exception...

Exception

Elasticsearch.Net.ElasticsearchClientException was unhandled
  HResult=-2146233088
  Message=Dispatching Index() from NEST into to Elasticsearch.NET failed
Received a request marked as PUT
This endpoint accepts POST,PUT
The request might not have enough information provided to make any of these endpoints:
  - /{index}/{type}
  - /{index}/{type}/{id}

  Source=Nest
  StackTrace:
       at Nest.LowLevelDispatch.IndexDispatch[T](IRequest`1 p, PostData`1 body) in c:\code\elasticsearch-net\src\Nest\_Generated\_LowLevelDispatch.generated.cs:line 987
       at Nest.ElasticClient.Nest.IHighLevelToLowLevelDispatcher.Dispatch[TRequest,TQueryString,TResponse](TRequest request, Func`3 responseGenerator, Func`3 dispatch) in c:\code\elasticsearch-net\src\Nest\ElasticClient.cs:line 56
       at Nest.ElasticClient.Nest.IHighLevelToLowLevelDispatcher.Dispatch[TRequest,TQueryString,TResponse](TRequest request, Func`3 dispatch) in c:\code\elasticsearch-net\src\Nest\ElasticClient.cs:line 46
       at Nest.ElasticClient.Index(IIndexRequest request) in c:\code\elasticsearch-net\src\Nest\Document\Single\Index\ElasticClient-Index.cs:line 40
       at Nest.ElasticClient.Index[T](T object, Func`2 selector) in c:\code\elasticsearch-net\src\Nest\Document\Single\Index\ElasticClient-Index.cs:line 34
       at ConsoleApplication2.Program.Main(String[] args) in c:\users\ronaldde\documents\visual studio 2015\Projects\ConsoleApplication2\ConsoleApplication2\Program.cs:line 27
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

As far as I understand from the docs, the client should be 'deriving' the {index} (from the api I read, it should be my-application) and {type} from the class. Below all the details...

Elastic Search version

{
  "name" : "Black Queen",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "2.2.0",
    "build_hash" : "8ff36d139e16f8720f2947ef62c8167a888992fe",
    "build_timestamp" : "2016-01-27T13:32:39Z",
    "build_snapshot" : false,
    "lucene_version" : "5.4.1"
  },
  "tagline" : "You Know, for Search"
}

Nest client version (Package Manager Console Output)

...
Added package 'NEST.2.0.2' to 'packages.config'

The offending code

using System;
using System.Diagnostics;
using Nest;

namespace ConsoleApplication2
{
    class Program
    {
        private static void Main(string[] args)
        {
            var node = new Uri("http://localhost:9200");
            var settings = new ConnectionSettings(node);
            var client = new ElasticClient(settings);

            var tweet = new Tweet
            {
                Id = 1,
                User = "kimchy",
                PostDate = new DateTime(2009, 11, 15),
                Message = "Trying out NEST, so far so good?"
            };

            var response = client.Index(tweet); // => error happens here

            Debug.Write(response.Created);
        }
    }

    public class Tweet
    {
        public int Id { get; set; }
        public string User { get; set; }
        public DateTime PostDate { get; set; }
        public string Message { get; set; }
    }
}

Is it the lack of coffee, the sleep deprivation or ... ?

Thanks again!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions