Skip to content

Having some troubles... and documentation seems inaccurate to current version (v1.7.0) #1528

@thunderstumpges

Description

@thunderstumpges

First let me preface this with the comment that I really like the potential of this library, and love the fluent interface approach. I am sorry if I sound frustrated, but with Elasticsearch being a steep learning curve anyway, it is tough if the documentation for the library is incomplete or inaccurate. I can't say for sure if I am running into bugs or just undocumented "features" :)

I am using documentation provided at http://nest.azurewebsites.net/

Starting at the beginning. I need to create a mapping.

  1. Starting with attribute mapping on my type, the documentation shows many ElasticType attribute properties, but on mine I only see two: Name and important one for me IdProperty which I'm guessing (and hoping) is to tell Nest what property should be mapped to the _id for the type. It is not shown nor discussed in the documentation.
  2. Documentation for Map<T>() shows an empty method signature:
var response = this.ConnectedClient.Map<ElasticSearchProject>();

However in code, it takes a Func<PutMappingDescriptor<T>,PutMappingDescriptor<T>>

While I have seen references in other places in the documentation of use of this with m => m.MapFromAttributes() I'm not 100% certain what this does (though I guessed that it should map my type from the attributes I specified.

I have (I believe) successfully created my mapping (though I don't see any reference to the id field when I get the mapping back using a raw REST call)

  1. Attempting to use the BulkAsync call was failing for me using almost exactly the code example in the Bulk documentation. Documentation shows:
var descriptor = new BulkDescriptor();

foreach (var i in Enumerable.Range(0, 1000))
{
    descriptor.Index<ElasticSearchProject>(op => op
        .Document(new ElasticSearchProject {Id = i})
    );
}
var result = client.Bulk(descriptor);

With that code, and my attribute annotated type, the result from the Bulk call were validation errors on every operation saying "missing index, missing type". SO I then found undocumented... an option for "Index" and "Type" on the descriptor.Index call:

bulk.Index<MyType>(op => op.Index("myindex").Type("mytype").Document(objMyType));

This didn't help :(

Only when I finally tried the also undocumented FixedPath option on the BulkDescriptor object did it actually specify the index and type in the request (and I'm guessing it would have to be the same index and type for all documents in the BulkDescriptor request..?

bulk.FixedPath("myindex","mytype");

  1. After finally getting a bunch of documents indexed, I notice it is NOT using my id field as specified in the ElasticType(IdProperty="id") attribute. Instead I get internally generated IDs for all of my documents.

Am I just missing some more documentation somewhere? Is there a bug with the code? I can't tell for sure. Thanks in advance.

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