'Why did hit count increase after adding ElasticSearch mapping?

I added a mapping to ElasticSearch. A while after adding the mapping, I noticed the hit count when querying an unrelated property was much higher than it should be.

Is the change in hit count a result of the operations I performed, or is it more likely that something else is going on? Did these operations introduce duplicate documents?

UPDATE: Duplicates were introduced to ElasticSearch by another process.

(1) Added a new mapping to support numeric searching, like this:

PUT http://myserver:9200/foo/bar/_mapping
{
    "properties": {
        "price": {
            "type": "text",
            "fields": {
                "numeric": {
                    "type": "double"
                }
            }
        }
    }
}

(2) Then I sent _update_by_query with no post body:

POST http://myserver:9200/foo/bar/_update_by_query

(3) Added a numeric mapping to another property the same way as the last two steps.

After this operation, the hit count for the following query increased by approx 4x. There are (should be) only approx 50,000 documents where document_status = active, but the query now returns a hit count of around 200,000. The property I'm querying on was NOT modified in the previous steps.

POST http://myserver:9200/foo/bar/_search
{
    "query": {
        "bool": {
            "must": [
                {
                    "match_all": {}
                },
                {
                    "match_phrase": {
                        "document_status": {
                            "query": "active"
                        }
                    }
                }
            ],
            "filter": [],
            "should": [],
            "must_not": []
        }
    },
    "from": 0,
    "size": 0
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source