0

I'm using elastic search version 7.1.0 and NEST 6.7.0 with Elasticsearch.Net 6.7.0. While I'm trying to create an index I've got an error.

This is my code, I was using the same code on NEST and Elasticsearch.Net version 6.4.0 and it was working fine

var result =   Client.CreateIndex(DefaultIndex, c => c
                .Settings(s => s
                    .NumberOfShards(numberOfShards)
                    .NumberOfReplicas(numberOfReplicas)
                    .BlocksReadOnly(false)
                )
                .Mappings(m => m
                    .Map<SearchDocument>(mm => mm
                        .AutoMap(3)
                    )
                )
            );

This is the error that I got

Invalid NEST response built from a unsuccessful low level call on PUT: /local_brainbank_index

Audit trail of this API call:

  • [1] BadResponse: Node: http://localhost:9200/ Took: 00:00:00.2880040

    OriginalException: Elasticsearch.Net.ElasticsearchClientException: The remote server returned an error: (400) Bad Request.. Call: Status

code 400 from: PUT /local_brainbank_index. ServerError: Type: mapper_parsing_exception Reason: "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [searchdocument : {properties={sourceId={type=integer}, sourceType={type=text, fields={keyword={ignore_above=256, type=keyword}}}, authorName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, subject={type=text, fields={keyword={ignore_above=256, type=keyword}}}, imageURL={type=text, fields={keyword={ignore_above=256, type=keyword}}}, id={type=text, fields={keyword={ignore_above=256, type=keyword}}}, sourceName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, body={type=text, fields={keyword={ignore_above=256, type=keyword}}}, uRL={type=text, fields={keyword={ignore_above=256, type=keyword}}}}}]" CausedBy: "Type: mapper_parsing_exception Reason: "Root mapping definition has unsupported parameters: [searchdocument : {properties={sourceId={type=integer}, sourceType={type=text, fields={keyword={ignore_above=256, type=keyword}}}, authorName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, subject={type=text, fields={keyword={ignore_above=256, type=keyword}}}, imageURL={type=text, fields={keyword={ignore_above=256, type=keyword}}}, id={type=text, fields={keyword={ignore_above=256, type=keyword}}}, sourceName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, body={type=text, fields={keyword={ignore_above=256, type=keyword}}}, uRL={type=text, fields={keyword={ignore_above=256, type=keyword}}}}}]"" ---> System.Net.WebException: The remote server returned an error: (400) Bad Request. at System.Net.HttpWebRequest.GetResponse() at Elasticsearch.Net.HttpWebRequestConnection.Request[TResponse](RequestData requestData) --- End of inner exception stack trace ---

Request:

{"mappings":{"searchdocument":{"properties":{"id":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"sourceType":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"sourceId":{"type":"integer"},"sourceName":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"authorName":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"subject":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"body":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"uRL":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"imageURL":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}}}}},"settings":{"index.number_of_replicas":0,"index.blocks.read_only":false,"index.number_of_shards":1}}

Response:

{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters: [searchdocument : {properties={sourceId={type=integer}, sourceType={type=text, fields={keyword={ignore_above=256, type=keyword}}}, authorName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, subject={type=text, fields={keyword={ignore_above=256, type=keyword}}}, imageURL={type=text, fields={keyword={ignore_above=256, type=keyword}}}, id={type=text, fields={keyword={ignore_above=256, type=keyword}}}, sourceName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, body={type=text, fields={keyword={ignore_above=256, type=keyword}}}, uRL={type=text, fields={keyword={ignore_above=256, type=keyword}}}}}]"}],"type":"mapper_parsing_exception","reason":"Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [searchdocument : {properties={sourceId={type=integer}, sourceType={type=text, fields={keyword={ignore_above=256, type=keyword}}}, authorName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, subject={type=text, fields={keyword={ignore_above=256, type=keyword}}}, imageURL={type=text, fields={keyword={ignore_above=256, type=keyword}}}, id={type=text, fields={keyword={ignore_above=256, type=keyword}}}, sourceName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, body={type=text, fields={keyword={ignore_above=256, type=keyword}}}, uRL={type=text, fields={keyword={ignore_above=256, type=keyword}}}}}]","caused_by":{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters: [searchdocument : {properties={sourceId={type=integer}, sourceType={type=text, fields={keyword={ignore_above=256, type=keyword}}}, authorName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, subject={type=text, fields={keyword={ignore_above=256, type=keyword}}}, imageURL={type=text, fields={keyword={ignore_above=256, type=keyword}}}, id={type=text, fields={keyword={ignore_above=256, type=keyword}}}, sourceName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, body={type=text, fields={keyword={ignore_above=256, type=keyword}}}, uRL={type=text, fields={keyword={ignore_above=256, type=keyword}}}}}]"}},"status":400}

4
  • 1
    Elasticsearch in version 7.x works best with NEST in version 7.x. Commented May 22, 2019 at 15:09
  • @Rob there is no 7.x version for NEST. The latest version is 6.7.0. which I'm using Commented May 22, 2019 at 15:22
  • 1
    There is, but in alpha. You need to check “ allow prereleases” checkbox(or dropdown) in nuget manager. i.sstatic.net/YFlp5.jpg Commented May 22, 2019 at 15:25
  • One line: Update your ElasticSearch.NET with the version number for your ElasticSearch installed. Commented Sep 12, 2019 at 18:52

1 Answer 1

0

NEST and Elasticsearch.Net 6.7.0 are not compatible with Elasticsearch 7.x. Please use NEST and Elasticsearch.Net 7.x, the latest of which to be released is 7.0.0-alpha2 at this time.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.