Cannot search new documents after reindexing

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

This is the result when searching by order_id

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

Can anyone help me with this?

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 return for your query and the document. you would like to match?

Thanks!

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

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

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

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