# Cannot search new documents after reindexing

**URL:** <https://discuss.elastic.co/t/cannot-search-new-documents-after-reindexing/273911>\
**Category:** Elasticsearch\
**Created:** [May 25, 2021, 9:14am UTC](https://discuss.elastic.co/t/cannot-search-new-documents-after-reindexing/273911 "2021-05-25T09:14:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrey2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrey2/32/89218_2.png) [@Andrey2](https://discuss.elastic.co/u/Andrey2)\
**Post date:** [May 25, 2021, 9:14am UTC](https://discuss.elastic.co/t/cannot-search-new-documents-after-reindexing/273911/1 "2021-05-25T09:14:25Z")

</div>

Hi all,

I'm having a problem with reindexing.  
I have an index called `emails`, after reindexing, I can get/post documents to this index normally.  
But for new documents, I cannot get these when search by property or show them in a query with sort.

This is the result when searching by \_id

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/b/0b354178bfe8e96a79620356434a2dadc6c34691.png)

This is the result when searching by `order_id`

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/4/7400d0e442aab45d1f544cd7e582743c177b7288.png)

also when sorting, i cannot get the latest order by `date_sent` (the above recrod has `date_sent` = 2021-05-25)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/4/749dca508705f1f1a5c5187cd6569495b7218732.png)

Can anyone help me with this?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [May 25, 2021, 10:25am UTC](https://discuss.elastic.co/t/cannot-search-new-documents-after-reindexing/273911/2 "2021-05-25T10:25:23Z")

</div>

Hey,

please refrain from using screenshots, but use code snippets. This forum has excellent markdown support for code snippets. Thank you!

First, have you refresh/flushed the index?  
Second, what does `GET emails/_search` return? Doucments from that index?  
Third, what is the mapping for the `order_time` field?  
Fourth, which Elasticsearch version is this?  
Fifth, what does the [Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/7.12/search-explain.html) return for your query and the document. you would like to match?

Thanks!

---

<div class="post-metadata">

**Author:** ![Andrey2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrey2/32/89218_2.png) [@Andrey2](https://discuss.elastic.co/u/Andrey2)\
**Post date:** [May 25, 2021, 1:12pm UTC](https://discuss.elastic.co/t/cannot-search-new-documents-after-reindexing/273911/3 "2021-05-25T13:12:55Z")

</div>

Hi spinscale

1. Yes, I tried both `refresh` and `flushed`. It's not working
2. Yes, documents from that index
3. This is my mapping  
`{ "emails" : { "mappings" : { "properties" : { "_doc" : { "properties" : { "client_id" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "date_sent" : { "type" : "date" }, "delivery_date" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "delivery_template" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "ean" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "new_template" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "order_id" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "sender" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "stage" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "subject_delivery" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "subject_new" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "to_email" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "to_name" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } } } }, "client_id" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "date_sent" : { "type" : "date" }, "delivery_date" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "delivery_template" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "ean" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "new_template" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "order_id" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "sender" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "stage" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "status" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "subject_delivery" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "subject_new" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "to_email" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "to_name" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } } } } } } `
4. I use version `7.2.0`
5. This is the result:  
`{ "_index" : "emails", "_type" : "_doc", "_id" : "5056128112595_1231612770", "matched" : false, "explanation" : { "value" : 0.0, "description" : "no matching term", "details" : [] } } `

Thanks a lot

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [May 25, 2021, 2:08pm UTC](https://discuss.elastic.co/t/cannot-search-new-documents-after-reindexing/273911/4 "2021-05-25T14:08:35Z")

</div>

Your `order_id` field is an analyzed text field, which it probably was not before. Try searching in the `order_id.keyword` field instead. Is it possible, that you have not copied the mapping before reindexing?

--Alex

---

<div class="post-metadata">

**Author:** ![Andrey2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrey2/32/89218_2.png) [@Andrey2](https://discuss.elastic.co/u/Andrey2)\
**Post date:** [May 26, 2021, 3:10am UTC](https://discuss.elastic.co/t/cannot-search-new-documents-after-reindexing/273911/5 "2021-05-26T03:10:11Z")

</div>

hi Alex,  
I copied the entire mapping when reindexing.  
Both `order_id`, `order_id.keyword` are not working.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 23, 2021, 3:11am UTC](https://discuss.elastic.co/t/cannot-search-new-documents-after-reindexing/273911/6 "2021-06-23T03:11:11Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
