0

define a schema just like this:

field id type string {
                indexing: summary | index
            }

then post some data

curl --location --request POST 'http://xxxxxxx:xxx/document/v1/mt_challenge/mt_challenge/docid/1680092807002114?create=true' --header 'Content-Type: application/json' --data-raw ' {"fields": {"id": {"assign": "1680092807002114"}}}'

and return

{"errors":[{"description":"UNSPECIFIED Has created a composite field value the reader does not know how to handle: com.yahoo.document.datatypes.StringFieldValue This is a bug. token = START_OBJECT","id":-15}],"id":"id:mt_challenge:mt_challenge::1680092807002114","pathId":"/document/v1/mt_challenge/mt_challenge/docid/1680092807002114"}

1 Answers1

2

POST is used to create a document, PUT to update. Here you use POST with using assign which generates the error.

Correct syntax for POST (create) :

curl --location --request POST 'http://xxxxxxx:xxx/document/v1/mt_challenge/mt_challenge/docid/1680092807002114?create=true' --header 'Content-Type: application/json' --data-raw ' {"fields": {"id":"1680092807002114"}}'
Jo Kristian Bergum
  • 2,984
  • 5
  • 8