"No mapping found for [@timestamp] in order to sort on"

Hey, I have this error:

{"error":{"root_cause":[{"type":"query_shard_exception","reason":"No mapping found for [@timestamp] in order to sort on","index_uuid":"0qKrRe3tQbKYhi5ps_WcCw","index":"products"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"can_match","grouped":true,"failed_shards":[{"shard":0,"index":"products","node":"asmTRFlgThS7kBU6yyCJzA","reason":{"type":"query_shard_exception","reason":"No mapping found for [@timestamp] in order to sort on","index_uuid":"0qKrRe3tQbKYhi5ps_WcCw","index":"products"}}]},"status":400}

So what's wrong?

PUT /products
{
  "settings": {
    "number_of_replicas": 2,
    "number_of_shards": 2
  }
}

that's my products index:

POST /products/_doc
{
  "name": "Coffee Maker",
  "price": 64
}

POST /products/_doc
{
  "name": "Ice Tea",
  "price": 50
}

POST /products/_doc
{
  "name": "products",
  "price": 10
}

You have no timestamp field.

how to create it?

Add it to your document, you may need to use mappings when you put the index though, to make sure it stored correctly (ie not as a string).

Actually, may be you don't need it.

I guess the error message is coming from Kibana? Or is it coming from another place?
If it comes from kibana, when you create the index pattern, just choose "I don't have a timestamp".

1 Like