user10091301
user10091301

Reputation:

unknown key [High] for create index

I created an index in elastic search which looks like

{"amazingdocs":{"aliases":{},"mappings":{"properties":{"Adj Close":{"type":"text"},"Close":{"type":"text"},"Date":{"type":"text"},"High":{"type":"text"},"Low":{"type":"text"},"Open":{"type":"text"},"Volume":{"type":"text"}}},"settings":{"index":{"creation_date":"1563168811565","number_of_shards":"1","number_of_replicas":"1","uuid":"k2wCARIETvufWmrdkDOtyw","version":{"created":"7020099"},"provided_name":"amazingdocs"}}}}

But now when I am when I am trying to insert a doc in it using kibana ,I am getting following error

{
  "error": {
    "root_cause": [
      {
        "type": "parse_exception",
        "reason": "unknown key [High] for create index"
      }
    ],
    "type": "parse_exception",
    "reason": "unknown key [High] for create index"
  },
  "status": 400
}

the syntax ,I am following is

PUT /amazingdocs/ 
{
    "Date": "1960-10-06",
    "Open": "53.720001",
    "High": "53.720001",
    "Low": "53.720001",
    "Close": "53.720001",
    "Adj Close": "53.720001",
    "Volume": "2510000"
}

Moreover ,when I am trying to insert the bulk data with similar fields ,I get following error

"{"took":66336,"errors":true,"items":[{"index":{"_index":"amazingdocs","_type":"_doc","_id":"O7o_9GsBcUaBu1lEWjja","status":400,"error":{"type":"mapper_parsing_exception","reason":"failed to parse","caused_by":{"type":"not_x_content_exception","reason":"Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"}}}}

Upvotes: 2

Views: 15606

Answers (1)

Shubham Dixit
Shubham Dixit

Reputation: 1

You are following the wrong syntax to insert in the elastic ,the write syntax will be

PUT /amazingdocs/_doc/1 
{
    "Date": "1960-10-06",
    "Open": "53.720001",
    "High": "53.720001",
    "Low": "53.720001",
    "Close": "53.720001",
    "Adj Close": "53.720001",
    "Volume": "2510000"
}

reference -here

Upvotes: 10

Related Questions