question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

7.0.0 ElasticsearchTypeAttribute should continue to support Name property

See original GitHub issue

NEST/Elasticsearch.Net version: 7.0.0-alpha1 Elasticsearch version: 7.0.0 Description of the problem including expected versus actual behavior:

Actual Even though mapping types have been removed in Elasticsearch 7.x, option to set name of the class for serialization is still useful when using fluent/strongly-type interfaces.

  1. When defining Join in index mapping:
_client.CreateIndexAsync(IndexName,
    index => index.Map<MyDocument>(
        tmd => tmd.AutoMap()
        .Properties(
            props => props.Join(
                j => j.Name(p => p.Relationship)
                .Relations(
                    r => r.Join<ParentType, ChildType>()
                    )
                )
            )
        )
    );
  1. When linking instances of child types to parent types:
var parent = new ParentType { Id = 1 };
var parentDoc = new MyDocument
{
    Parent = parent,
    Relationship = JoinField.Root<ParentType>()
}

var childDoc = new MyDocument
{
    Child = new ChildType(),
    Relationship = JoinField.Link<ChildType>(new Id(parent.Id))
}
  1. When using JoinAttribute on JoinField property:
public class MyDocument
{
    public ParentType Parent { get; set; }

    public ChildType Child { get; set; }

    [Join(typeof(ParentType), typeof(ChildType))]
    public JoinField Relationship { get; set; }
}

Expected Therefore, possibility to override class name for serialization should still be supported. In the past ElasticsearchTypeAttribute’s Name property was used for this.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
Mpdreamzcommented, Apr 25, 2019

Thank you a ton for reporting this @nenadvicentic

ElasticsearchTypeAttribute.RelationName now controls this.

Since this obscure I think it be best if we ship .Name and mark it obsolete instead, @codebrain @russcam thoughts?

0reactions
russcamcommented, May 7, 2019

Closing this as #3702 has been merged. Will be in the next release

Read more comments on GitHub >

github_iconTop Results From Across the Web

Removal of mapping types | Elasticsearch Guide [8.9]
Elasticsearch 8.0.0 no longer supports mapping types. For details on how to migrate your clusters away from mapping types, see the removal of...
Read more >
Could not load file or assembly 'Elasticsearch.Net' or one of ...
In case it helps anyone, the solution is to edit Web.config and change <assemblyIdentity name="Elasticsearch.
Read more >
Using Elasticsearch with ASP.NET Core and Docker
Recently, I got an assignment for my employer's internal project to investigate Elasticsearch and its usage from within ASP.NET Core 2.1 app ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found