Saint
Saint

Reputation: 5469

Elasticsearch PUT documents in strange order

How do set elasticsearch to be adding new documents with PUT method at the end (or the beginning).

Now it's adding new ones sometimes at the end, sometimes in the middle.

I know I can sort results by some field, but I want to see them in browser just ordered by time added without any additional parameters

Upvotes: 0

Views: 52

Answers (1)

Val
Val

Reputation: 217274

ES is simply a document store, i.e. there's no inherent insertion order. I'd simply go with adding ?sort=yourdatefield:desc to your URL and you're all set.

If you don't add any specific sort field, it will sort by score which defaults to 1.0, so the order is undefined actually.

Upvotes: 1

Related Questions