Summary
I'm using ignore_malformed
, but get no results when searching for the _ignored
field.
Details
I've isolated the problem to a small example. I:
- Create the index with
ignore_malformed
set totrue
. - Insert a couple of documents with invalid values.
- Observe that both documents are in the index as expected.
- Search for the ignored fields, but I expected some results and got none.
Here's the test code:
PUT /test_points
{
"settings": {
"index.mapping.ignore_malformed": true
},
"mappings": {
"properties": {
"timestamp": { "type": "date" },
"start_point": { "type": "geo_point" }
}
}
}
POST /test_points/_doc/
{
"timestamp": "2022-07-23T11:42:00",
"start_point": "120.0,120.0"
}
POST /test_points/_doc/
{
"timestamp": "2022-07-23T11:43:00",
"start_point": [130.0, 130.0]
}
Here are the unexpected results mentioned above:
GET /test_points/_search
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 2,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "test_points",
"_id" : "p2QvLIIBVKX1Q3v1B-HR",
"_score" : 1.0,
"_source" : {
"timestamp" : "2022-07-23T11:42:00",
"start_point" : "120.0,120.0"
}
},
{
"_index" : "test_points",
"_id" : "qGQvLIIBVKX1Q3v1EOGC",
"_score" : 1.0,
"_source" : {
"timestamp" : "2022-07-23T11:43:00",
"start_point" : [
130.0,
130.0
]
}
}
]
}
}
The start_point
for one document is returned as "120.0,120.0"
and for the other [130.0, 130.0]
. While this is what I sent over, I would expect Elasticsearch to do some normalization on values?
Not a big deal though, the bigger problem is this:
GET /test_points/_search
{
"query": {
"exists": {
"field": "_ignored"
}
}
}
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 0,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
}
}
No hits. Shouldn't I get something as mentioned in the docs?