Hello, I have the following schema for an index, with some example documents. My use-case is that I'm indexing a book and I am indexing by page.
I'm trying to update the contents of a page if the user decides to edit a particular page, but there's a weird error no-one else seems to have encountered.
PUT my-index
{}
PUT my-index/_mapping
{
"properties": {
"page": {
"type": "long"
},
"title": {
"type": "keyword"
},
"content": {
"type": "text"
}
}
}
POST _bulk
{ "index" : { "_index" : "my-index", "_id" : "doc_1.pg_1" } }
{ "page" : 1, "title": "doc_1", "content": "a quick brown fox jumped over the lazy dog ..."}
{ "index" : { "_index" : "my-index", "_id" : "doc_1.pg_2" } }
{ "page" : 2, "title": "doc_1", "content": "... and the fox landed in a briar patch"}
{ "index" : { "_index" : "my-index", "_id" : "doc_2.pg_1" } }
{ "page" : 1, "title": "doc_2", "content": "a slow orange fox leapt over the barky dog ..."}
{ "index" : { "_index" : "my-index", "_id" : "doc_2.pg_2" } }
{ "page" : 2, "title": "doc_2", "content": "... and the dog lept and got the fox"}
Here's the update API call and the response:
POST my-index/_update/doc_1.pg_1
{
"doc": {
"content" : "a slow fox jumped over the really fast dog"
}
}
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "cannot change field \"content\" from index options=DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS to inconsistent index options=DOCS_AND_FREQS_AND_POSITIONS"
}
],
"type" : "illegal_argument_exception",
"reason" : "cannot change field \"content\" from index options=DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS to inconsistent index options=DOCS_AND_FREQS_AND_POSITIONS"
},
"status" : 400
}
I've also tried to update the content field with a script too, but I got the same error:
POST /my-index/_update/doc_1.pg_1
{
"script": {
"source": "ctx._source['content'] = 'a slow fox jumped over the really fast dog'"
}
}
Does anyone seem to understand what's going on? Can you help me?
Thanks in advance.