Skip to content

5.1 Unable to use index templates to reindex into daily indexes. #22435

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

Closed
niemyjski opened this issue Jan 4, 2017 · 6 comments
Closed

5.1 Unable to use index templates to reindex into daily indexes. #22435

niemyjski opened this issue Jan 4, 2017 · 6 comments
Assignees

Comments

@niemyjski
Copy link
Contributor

From the docs (https://www.elastic.co/guide/en/elasticsearch/reference/5.1/docs-reindex.html#_reindex_daily_indices) it sounds like this is possible but I run into issues using an index template. This might also reference: #18654 and #20465

My issue is simple, I am upgrading our oss project from 1.x to 5.x using external reindex. We are moving from monthly indexes to daily indexes and I have no clue how many indexes should be created (this needs to run on everyones machine and we are calculating it with a inline script based on a doc's utc time). So an index template would work perfectly just for the reindex. The problem is, I get index not found exceptions on reindex...

PUT _template/events-v1
{
  "template": "events-v1-*"
  ........
}
POST _reindex?wait_for_completion=false
{
  "source": {
    "remote": {
      "host": "http://localhost:9201"
    },
    "index": "events-v1-*",
    "sort": { "date": "desc" }
  },
  "dest": {
    "index": "events-v1-error"
  },
  "script": {
    "lang": "painless",
    "inline": "ctx._index = 'events-v1-' + DateTimeFormatter.ofPattern('yyyy.MM.dd').format(OffsetDateTime.parse(ctx._source.date).toInstant().atZone(ZoneOffset.UTC));"
  }
}

results in millions and millions of these errors:

{
      "index": "events-v1-2016.12.30",
      "type": "events",
      "id": "586651aba5abbe018465d6b6",
      "cause": {
        "type": "index_not_found_exception",
        "reason": "no such index",
        "resource.type": "index_expression",
        "resource.id": "events-v1-2016.12.30",
        "index_uuid": "_na_",
        "index": "events-v1-2016.12.30"
      },
      "status": 404
    }
@niemyjski
Copy link
Contributor Author

Doh, narrowed this down to action.auto_create_index: false I wonder if there is anything we can do to improve this error message?

@nik9000 nik9000 self-assigned this Jan 4, 2017
@nik9000 nik9000 reopened this Jan 4, 2017
@nik9000
Copy link
Member

nik9000 commented Jan 4, 2017

I'll have a look at improving the error message.

@niemyjski
Copy link
Contributor Author

niemyjski commented Jan 4, 2017

Also, seems like there should be a auto_create_index mode that creates indexes when they match a template, but otherwise it doesn't happen..

@jasontedor
Copy link
Member

@niemyjski We have an open issue for that: #20640

@nik9000
Copy link
Member

nik9000 commented Jan 4, 2017

auto_create_index can be a pattern (see bottom of this). I think that might be enough, at least for now.

@nik9000
Copy link
Member

nik9000 commented Jan 4, 2017

auto_create_index can be a pattern (see bottom of this). I think that might be enough, at least for now.

Sorry, hadn't updated my window and didn't know about the issue.

nik9000 added a commit to nik9000/elasticsearch that referenced this issue Jan 18, 2017
Changes the error message when `action.auto_create_index` or
`index.mapper.dynamic` forbids automatic creation of an index
from `no such index` to one of:
* `no such index and [action.auto_create_index] is [false]`
* `no such index and [index.mapper.dynamic] is [false]`
* `no such index and [action.auto_create_index] contains [-<pattern>] which forbids automatic creation of the index`
* `no such index and [action.auto_create_index] ([all patterns]) doesn't match`

This should make it more clear *why* there is `no such index`.

Closes elastic#22435
nik9000 added a commit that referenced this issue Jan 18, 2017
Changes the error message when `action.auto_create_index` or
`index.mapper.dynamic` forbids automatic creation of an index
from `no such index` to one of:
* `no such index and [action.auto_create_index] is [false]`
* `no such index and [index.mapper.dynamic] is [false]`
* `no such index and [action.auto_create_index] contains [-<pattern>] which forbids automatic creation of the index`
* `no such index and [action.auto_create_index] ([all patterns]) doesn't match`

This should make it more clear *why* there is `no such index`.

Closes #22435
nik9000 added a commit that referenced this issue Jan 18, 2017
Changes the error message when `action.auto_create_index` or
`index.mapper.dynamic` forbids automatic creation of an index
from `no such index` to one of:
* `no such index and [action.auto_create_index] is [false]`
* `no such index and [index.mapper.dynamic] is [false]`
* `no such index and [action.auto_create_index] contains [-<pattern>] which forbids automatic creation of the index`
* `no such index and [action.auto_create_index] ([all patterns]) doesn't match`

This should make it more clear *why* there is `no such index`.

Closes #22435
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants