Problem re-adding the same fields to start with a lowercase letter when updating

Hello dear friends. I am encountering a problem while updating. The problem I'm having is, for example, I want to update the Title field, but I see that a new field has been created for the Title field in the document. (A title field that starts with a lowercase letter). I'm doing the update process with NEST, can anyone share an idea with me? Thank you in advance for your help :slight_smile:

The state of the document before the update:

      {
        "_index" : "my_test_index",
        "_type" : "_doc",
        "_id" : "uPggFnoBChFNLIc8qdjW",
        "_score" : 31.908756,
        "_source" : {
          "RelatedPassiveCompanyId" : "0d075c1681106286cfe9f31999f8247c",
          "CreateTime" : "2021-06-16T21:41:17.2697847+03:00",
          "Title" : "FE NEW CENTURY INDUSTRY(SINGAPORE)PTE LTD",
          "IsBannedFromOpenCorpCompanies" : false,
          "CreatedBy" : 1,
          "IsActivated" : false,
          "IsCancelled" : false,
          "IsMembershipTypeBought" : false
        }
      }

The state of the document after the update:

      {
        "_index" : "my_test_index",
        "_type" : "_doc",
        "_id" : "uPggFnoBChFNLIc8qdjW",
        "_score" : 26.380388,
        "_source" : {
          "RelatedPassiveCompanyId" : "0d075c1681106286cfe9f31999f8247c",
          "CreateTime" : "2021-06-16T21:41:17.2697847+03:00",
          "Title" : "FE NEW CENTURY INDUSTRY(SINGAPORE)PTE LTD",
          "IsBannedFromOpenCorpCompanies" : false,
          "CreatedBy" : 1,
          "IsActivated" : false,
          "IsCancelled" : false,
          "IsMembershipTypeBought" : false,
          "isBannedFromOpenCorpCompanies" : false,
          "contactInformations" : {
            "contactPerson" : { },
            "phones" : [ ]
          },
          "isCancelled" : false,
          "dnbInformation" : {
            "processId" : "fba921ee-493d-4f12-aa0a-0a432b9e8b3a",
            "requestLogs" : [
              {
                "requestTime" : "2021-11-23T10:03:09.8302661+03:00",
                "message" : "Company not found on Dnb",
                "resultType" : 2
              }
            ]
          },
          "createTime" : "2021-06-16T21:41:17.2697847+03:00",
          "createdBy" : 1,
          "isMembershipTypeBought" : false,
          "isActivated" : false,
          "title" : "FE NEW CENTURY INDUSTRY(SINGAPORE)PTE LTD",
          "relatedPassiveCompanyId" : "0d075c1681106286cfe9f31999f8247c"
        }
      },

my update function:


public bool UpdateDocuments(IHit<MyESModel> documentHitItem)
        {
            var response = elasticClient.Update<MyESModel, object>(DocumentPath<MyESModel>
                .Id(documentHitItem.Id), u => u
                .Index("my_test_index")
                .Doc(documentHitItem.Source)
                .DocAsUpsert(true)
                .RetryOnConflict(8)
            );
            return response.IsValid;
        }

I would be very happy if anyone has any idea what the problem could be.

Hi Büşra,

By default, NEST assumes field names should be camelCase as is common for JSON documents. You may reconfigure the default behaviour such that field names match the PascalCase of the original property name. In your case, you need to pass the function as...

DefaultFieldNameInferrer(p => p);

Steve

Firstly thank you for giving, but I don't quite understand how to use it. I mean, do I need to use it in the mapping part while creating the index or is it in the update function?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.