unknown key [] for create index when creating a join-relation

Viewed 22

I've been trying to create an index that utilizes a join-relation. My initial code didn't work, so I checked out the documentation, and copy&pasted the example shown there (https://www.elastic.co/guide/en/elasticsearch/reference/current/parent-join.html)

My problem persists though, whenever I have a query parameter, such as ?refresh or ?routing=1 (as shown in the example) I keep getting the unknown key [] for create index-error. Removing this allows me to create the two questions, however, when trying to create the answers I keep getting that error, even without the ?refresh-parameter. I would assume this is because the ?routing=1-parameter is active - even though it's required for the join.

I'm using the trial from https://www.elastic.co, with standard settings, running on version 8.3. I tried a local(docker) version that runs 7.9.1 which runs without any problems. However, I have no idea how the local one is configured, or if the configuration has anything to do with the problem.

I'm running the code inside kibana, using dev tools

TL;DR: I keep getting a unknown key [] for create index-error when I use a query parameters

The code is (almost) straight from the documentation, but for good measure, I'll post it here anyway:

PUT my-index-000001
{
  "mappings": {
    "properties": {
      "my_id": {
        "type": "keyword"
      },
      "my_join_field": { 
        "type": "join",
        "relations": {
          "question": "answer" 
        }
      }
    }
  }
}

PUT my-index-000001/_doc/1 (notice that ?refresh has been removed)
{
  "my_id": "1",
  "text": "This is a question",
  "my_join_field": {
    "name": "question" 
  }
}

PUT my-index-000001/_doc/2 (notice that ?refresh has been removed)
{
  "my_id": "2",
  "text": "This is another question",
  "my_join_field": {
    "name": "question"
  }
}

PUT my-index-000001/_doc/3?routing=1 (notice that &refresh have been removed)
{
  "my_id": "3",
  "text": "This is an answer",
  "my_join_field": {
    "name": "answer", 
    "parent": "1" 
  }
}

PUT my-index-000001/_doc/4?routing=1&refresh
{
  "my_id": "4",
  "text": "This is another answer",
  "my_join_field": {
    "name": "answer",
    "parent": "1"
  }
}
0 Answers
Related