Anyone know why I’d be getting `RequestMalformed [...
# community-help
a
Anyone know why I’d be getting `RequestMalformed [Error]: Request failed with HTTP code 400 | Server said: Field
database_source
must be an optional field.` When creating schema:
Copy code
{
  "name": "federatedSearch",
  "fields": [
    {
      "name": "database_source",
      "optional": false,
      "type": "auto"
    },
    {
      "name": "title",
      "optional": false,
      "type": "auto"
    },
    {
      "name": "creator",
      "optional": true,
      "type": "auto"
    },
    {
      "name": "dateCreated",
      "optional": true,
      "facet": true,
      "type": "auto"
    },
    {
      "name": "location",
      "optional": true,
      "facet": true,
      "type": "auto"
    },
    {
      "name": "publisher",
      "optional": true,
      "type": "auto"
    },
    {
      "name": "collection",
      "optional": true,
      "type": "auto"
    },
    {
      "name": "id",
      "optional": true,
      "type": "auto"
    },
    {
      "name": "rights",
      "optional": true,
      "type": "auto"
    },
    {
      "name": "language",
      "optional": true,
      "type": "auto"
    },
    {
      "name": "subject",
      "optional": true,
      "type": "auto"
    },
    {
      "name": "format",
      "optional": true,
      "facet": true,
      "type": "auto"
    },
    {
      "name": "description",
      "optional": true,
      "type": "auto"
    },
    {
      "name": "contributor",
      "optional": true,
      "type": "auto"
    },
    {
      "name": "source",
      "optional": true,
      "type": "auto"
    },
    {
      "name": "url",
      "optional": false,
      "type": "auto"
    }
  ]
}
🙏🙏🙏
j
Fields that have
"type": "auto"
should be marked as optional.
Because by definition we infer these types based on incoming documents and not all documents might have all fields that existed in previous documents
Btw if you're enumerating each field and it's type like you have in the schema, might as well specify a type for it, and then you'll be able to set it to optional false
auto is typically useful when you don't know the data types for the fields ahead of time, or if you don't know the field names ahead of time and you can use a regex to define multiple fields as type auto
a
Thanks @Jason Bosco - I was being lazy for the POC! I think you’re right I’ll just type the fields 🙂
👍 1