0

I have to index the documents to show in the searches, but according to the input, the documents will be changing, for every search. So, currently, I am indexing when the user searches, But I'm deleting it just after the process, And again I'm doing the same process. Is it efficient or has any flaw? If so, how to overcome?

Nkosi
  • 235,767
  • 35
  • 427
  • 472
sweety
  • 23
  • 8
  • You index something, the user performs the search and then you deleted that "something"? You have one index where you index documents and then you delete them? Why not keeping the documents for longer? And why not deleting the entire index when you are done with it? (it's more efficient this way) – Andrei Stefan May 04 '16 at 10:59
  • It might also help to find a pattern among you documents so that they can be put into an `index` under a `type` for a period of time or you can have a time-series `index`. – Varun Natraaj May 04 '16 at 19:34
  • The documents indexed for one user are not useful for another user, that's why, for every user, I'm creating an index and deleting the index after the logout, But, it's taking much time. @AndreiStefan – sweety May 05 '16 at 04:16
  • Yes, if I add some more documents to the index after sometime, what happens to the old documents, which will come first in the search result? @VarunNatraaj – sweety May 05 '16 at 04:18
  • If you're not filtering your records based on any conditions, the results will be scored based on TF-IDF at an index level. If your query vary b/w users, try running the queries through an [alias](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html). You can add conditions to scope out old documents (which still remain in the index btw) and query only the new docs or any other condition for that matter. To remove old docs, you can run [delete-by-query](https://www.elastic.co/guide/en/elasticsearch/plugins/current/delete-by-query-usage.html) to remove them. – Varun Natraaj May 05 '16 at 06:53
  • Ok, But any idea on what happens to the old documents, which will be preferred the most by the filter query? @VarunNatraaj – sweety May 05 '16 at 09:37

0 Answers0