Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_ttl counting down faster than expected #10361

Closed
nithyanv opened this issue Apr 1, 2015 · 7 comments
Closed

_ttl counting down faster than expected #10361

nithyanv opened this issue Apr 1, 2015 · 7 comments
Assignees
Labels
>bug discuss :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch

Comments

@nithyanv
Copy link

nithyanv commented Apr 1, 2015

Hi,

I believe _ttl is counting down faster than it should.

I have the following resultset for an index.

{
_index: some_index
_type: some_type
_id: some_id
_score: 1
fields: {
my_id: some_Id
my_timestamp: [
2015-03-26 16:05:00+0530
]
_ttl: 1581673831
}

Since today is 01/04/15, the document is around 5 days old. However, if we were to check _ttl (1581673831 milliseconds = 18.3 days left). How is that possible? It should be around 25 days to go The index was mapped with the _template mapping given below. I have also given the _mapping that was set up dynamically by Elastic when data was fed into it. Please note that _ttl is set correctly as 2592000000 milliseconds = 30 days as per _template mapping.

For the following template mapping,

"my_template" : {
"order" : 1,
"template" : "my_index*",
"settings" : {
"index.mapping.allow_type_wrapper" : "true",
"index.refresh_interval" : "5s",
"index.store.compress.stored" : "true",
"index.cache.field.type" : "soft"
},
"mappings" : {
"default" : {
"_timestamp" : {
"enabled" : true,
"path" : "my_timestamp",
"format" : "YYYY-MM-dd HH:mm:ssZ"
},
"_ttl" : {
"enabled" : true,
"default" : "30d"
},
"properties" : {
"my_timestamp" : {
"format" : "YYYY-MM-dd HH:mm:ssZ",
"type" : "date"
},
"my_id" : {
"index" : "not_analyzed",
"type" : "string"
}
},
"_all" : {
"enabled" : false
}
}
},
"aliases" : { }
}
}

It has the following index mapping,

"my_index_2015.03.26" : {
"mappings" : {
"mytype1" : {
"_all" : {
"enabled" : false
},
"_timestamp" : {
"enabled" : true,
"path" : "my_timestamp",
"format" : "YYYY-MM-dd HH:mm:ssZ"
},
"_ttl" : {
"enabled" : true,
"default" : 2592000000
},
"properties" : {
"my_id" : {
"type" : "string",
"index" : "not_analyzed"
},
"my_timestamp" : {
"type" : "date",
"format" : "YYYY-MM-dd HH:mm:ssZ"
}
}
}
}
}
}

@clintongormley
Copy link
Contributor

Hi @nithyanv

When I try out your examples, the _ttl looks correct. I wonder if you ran an update request on this document?

@nithyanv
Copy link
Author

nithyanv commented Apr 6, 2015

We are populating using bulk input. Sometimes, we see overwrites (i.e) version is incremented some of our records may have same _id in the test data. But timestamp is the same even in these records. How does update affect _ttl?

@clintongormley
Copy link
Contributor

@nithyanv an update request could mess with the TTL, depending on what you set.

Perhaps check the version of the document with the bad TTL value? See if it is 1 or higher. Also try inserting a new document with the same timestamp, and see if it is also reflecting the wrong TTL?

It seems to work for me, so I'm trying to figure out what is different about your setup.

@nithyanv
Copy link
Author

@clintongormley I believe it is related to Update. We were also getting _version conflict as multiple threads were updating the same record over and over again. That was resolved with setting retryOnconflict(). But now we still get "org.elasticsearch.index.mapper.MapperParsingException: failed to parse [_ttl]" when writing over the same record. This is even though document is well within the ttl.

@clintongormley
Copy link
Contributor

Closing in favour of #11809

@clintongormley
Copy link
Contributor

I was incorrect - #11809 doesn't fix this issue. Reopening.

Related to #11802

@clintongormley clintongormley added >bug discuss :Search Foundations/Mapping Index mappings, including merging and defining field types and removed feedback_needed labels Jun 26, 2015
@clintongormley clintongormley self-assigned this Jun 26, 2015
@clintongormley
Copy link
Contributor

Closing in favour of #18280

@javanna javanna added the Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch label Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug discuss :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch
Projects
None yet
Development

No branches or pull requests

3 participants