Bit of an odd one or I'm missing something.
We reindexed an AWS Elasticsearch index from old_index
to new_index
but for some reason searches on the new index return no results.
The steps we took are:
Reindex
curl -H 'Content-Type: application/json' -XPOST 'hostname/_reindex' -d '
{
"source": {
"index": "old_index"
},
"dest": {
"index": "new_index"
}
}'
The mapping of the old index is:
{
"old_index": {
"mappings": {
"share": {
"dynamic": "false",
"properties": {
"creationDate": {
"type": "long"
},
"eventId": {
"type": "keyword"
},
"title": {
"type": "text"
},
"userId": {
"type": "keyword"
}
}
}
}
}
}
The mapping of the new index is:
{
"new_index": {
"mappings": {
"share": {
"properties": {
"age": {
"type": "long"
},
"creationDate": {
"type": "long"
},
"eventId": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"title": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"userId": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
If we do a match_all
query on either index both report an identical number of documents. However if we do a filter
query
like so:
{
"query": {
"bool": {
"filter": [
{
"term": {
"eventId": {
"value": "abc123"
}
}
}
]
}
}
}
Only the old_index
returns a match, the new index does not despite containing a document with a corresponding eventId
.
Questions are:
- Where is the
age
property in thenew_index
coming from? - Why is reindexing changing the mapping?
- Is there something in the mapping of
new_index
which is preventing our filterquery
above from working?