and all data are there.
We were not able to search seller_account_id when provided in multi_match for full text search
So we decided to update mapping for seller_account_id as multi_type field.
I believe no Re-indexing is required for update mapping, but how we should make data available in search, because when we updated mapping search was not working?, we tried to use bulk API to update all documents. but still old documents are not searchable , only new documents are coming in search, I tried with _bulk API with _refresh=true, but still no luck
Do I need to create new Index and reindex all documents.( I dont prefer this)
Our multi_match request
I would identify a few old documents that need to be updated and run an update by query with a filter to target just a few documents in order to verify that it works and resolves the issue. Once that is done you should be able to run the task without a body and process all documents. To be more selective you might also be able to write a query clause to select only documents that do not have the seller_account_id.keyword field defined.
How can I check if there is seller_account_id.keyword field is defined or not? can you share example.
Because if mapping is updated all document have seller_account_id available with seller_account_id.keyword right?
You can add a boolean query with a must_not exists clause.
Elasticsearch stores data in immutable segments. The new field will therefore not be added for existing documents unless you update them, causing them to be written to a new segment.
So there will not be required _reindex API to use in overall solution? Generally what steps should be follow when updating field as multi_type field in existing index? and also existing data should be available for searching?
If we use update_by_query , how we can resolve conflicts in existing documents?
Yes. Run a refresh before starting the update as the query clause relies on all old data being searchable.
If you have conflicts, I believe you should skip those documents as it indicates that a new version was indexed after you started the operation and that means it will automatically get the new mappings.
like adding temporary field like temp_id and bulk update all documents with this field , so document version would be updated and it will be available for search, right?
And after that I will remove field by updating mapping.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.