'How to index nullable fields on azure search

I'm using nodejs to create the index on azure search,

 {

        "name": "price_positioning",

        "type": "Edm.ComplexType",

        "fields": [

            {

                "name": "id",

                "type": "Edm.Double",

                "filterable": false

            },

            {

                "name": "name",

                "type": "Edm.String",

                "searchable": true,

                "filterable": true,

                "sortable": true,

                "facetable": true

            }

        ]

    },

and the json is :

[{"price_positioning":""},
{
"price_positioning":{"id":1.1,"name":"test"}
 }]

when I try to execute the progam it gives this error : "The request is invalid. Details: parameters : A 'PrimitiveValue' node with non-null value was found when trying to read the value of the property 'price_positioning'; however, a 'StartArray' node, a 'StartObject' node, or a 'PrimitiveValue' node with null value was expected.\r\n"

do you know please how can we index nullable fields ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source