I would like to know if I can temporarily save a document to an index, and when I want to actually fully publish/POST this document, can I take the "temporary"/"dry-run" flag away from the document?
Asked
Active
Viewed 1,407 times
2
-
How do you want it to behave while it's "temporary"/what is the purpose of doing this dry-run? – deceze Feb 10 '20 at 16:03
-
@deceze I'd like to temporarily save this document to query on then I'd like to take away the TTL if I'm satisfied with the results. – Justin Reddick Feb 10 '20 at 16:18
-
It's not clear what you're asking--you can update documents however you want and they'll be indexed accordingly. Similarly, if you want to use this flag as part of your searches, e.g., so "temporary" documents aren't returned, you may do so. – Dave Newton Feb 10 '20 at 16:26
-
@DaveNewton So with that thinking could I say "temporary" documents, I only want to save you if I purposely do a POST and if I don't intentionally do a manual save then get ready for garbage collection? That's what I mean by temporarily indexing a document. – Justin Reddick Feb 10 '20 at 16:30
-
@DaveNewton How can I make it so "temporary" documents aren't returned? – Justin Reddick Feb 10 '20 at 16:42
-
Add a "temporary" flag and modify the search to not return docs that have it set. I don't know of any way to index a document without adding it, but that doesn't mean there isn't one--although such a thing would seem weird to me. – Dave Newton Feb 10 '20 at 16:44
1 Answers
3
There is no out the box way do it but this is how I would do it :
- You can create a new index , to store the temporary documents.
Create an alias that covers both the temp index and the existing index, this will allow you to test your query locally.
when you are ready to "Release" the document copy it the "Real" index, and if it's many document use the reindex API from the temp index to the "real" one.

Shachaf.Gortler
- 5,655
- 14
- 43
- 71