| 1 |
How to access ElasticSearch on local machine (for testing): |
| 2 |
=========================================================== |
| 3 |
see: https://github.com/mobz/elasticsearch-head |
| 4 |
|
| 5 |
How to produce an error: |
| 6 |
======================== |
| 7 |
It's quite easy to get 400, if you put a wrong mapping to your |
| 8 |
index. That would be easy to reproduce in "normal" omelasticsearch usage |
| 9 |
conditions, by only altering the ES configuration: |
| 10 |
|
| 11 |
1. Make your index first. Let's call it "testindex": |
| 12 |
$ curl -XPUT localhost:9200/testindex/ |
| 13 |
|
| 14 |
2. Put your mapping for a search type called "mytype", where you specify |
| 15 |
that date property should be an integer: |
| 16 |
$ curl -XPUT localhost:9200/testindex/mytype/_mapping -d '{"mytype":{"properties": {"timegenerated":{"type":"integer"}}}}' |
| 17 |
|
| 18 |
3. Now try to insert something where date is not an integer: |
| 19 |
$ curl -XPOST localhost:9200/testindex/mytype/ -d '{"timegenerated":"bla"}' |
| 20 |
{"error":"MapperParsingException[Failed to parse [date]]; nested: NumberFormatException[For input string: \"bla\"]; ","status":400} |
| 21 |
|