0

I have modified a field type of CompanyName in PoCo in c# (NEST) from string to int (just for testing). first thing is that it is not reflecting in mapping of type. it is still showing string there

    "properties": {
       "AddressNumber": {
          "type": "string"
       },
       "City": {
          "type": "string"
       },
       "CompanyName": {
          "type": "string"
       },
       "ContactName": {
          "type": "string"
       },

But it does allow me to save the integer value of CompanyName. In marvel also, the data is showing like int.

Previous Document in ES

             {  "CompanyName": "1231",
               "ContactName": "sdfsdf",
               "City": "Schenectady"
             }

Last saved document after changing the field type to int

                 { "CompanyName": 1231,
                   "ContactName": "shivang",
                   "City": "Leeds"
                 }

It is searching fine with string and int values,If we try to save some string in it, it is showing CompanyName as 0 ( which is fine ). But why it is not showing the mapping correctly?

NOTE : I did not recreated the index. It is the existing index

Shivang MIttal
  • 990
  • 1
  • 14
  • 36

1 Answers1

1

Changing Mapping With Zero Downtime will explain this thoroughly, as pointed out by @Rob here and in this SO question.

I highly recommend reading about default mapping, dynamic mapping, and especially dynamic templates. I find this really helps me keep my code clean from attributes or mapping code and let my poco's be poco's!

Community
  • 1
  • 1
Jony Adamit
  • 3,178
  • 35
  • 44