Skip to content

Slowlog on Index Settings descriptor is not translated correctly to JSON #7865

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
TheFireCookie opened this issue Jul 28, 2023 · 3 comments · Fixed by #7875
Closed

Slowlog on Index Settings descriptor is not translated correctly to JSON #7865

TheFireCookie opened this issue Jul 28, 2023 · 3 comments · Fixed by #7875
Labels
8.x Relates to a 8.x client version

Comments

@TheFireCookie
Copy link
Contributor

Elastic.Clients.Elasticsearch version:
8.9.0

Elasticsearch version:
8.9.0

.NET runtime version:
7.0.9

Operating system version:
Windows 11

Description of the problem including expected versus actual behavior:
Using

private void SetIndexDescriptor(CreateIndexRequestDescriptor<T> createIndexDescriptor) =>
    createIndexDescriptor
      .Settings(s => s
        .IndexingSlowlog(d => d
          .Threshold(t => t
            .Fetch(f => f.Warn(TimeSpan.FromSeconds(1)))
            .Query(f => f.Warn(TimeSpan.FromSeconds(5)))
            .Index(f => f.Warn(TimeSpan.FromSeconds(5)))));

generate this JSON

{
    "settings": {
        "indexing.slowlog": {
            "threshold": {
                "fetch": {
                    "warn": "1s"
                },
                "index": {
                    "warn": "5s"
                },
                "query": {
                    "warn": "5s"
                }
            }
        }
    }
}

which is not supported by Elasticsearch 8.9 and replied by it:

{
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "unknown setting [index.indexing.slowlog.threshold.query.warn] did you mean any of [index.indexing.slowlog.threshold.index.warn, index.search.slowlog.threshold.query.warn, index.indexing.slowlog.threshold.index.trace, index.indexing.slowlog.threshold.index.info, index.indexing.slowlog.threshold.index.debug, index.search.slowlog.threshold.query.trace, index.search.slowlog.threshold.query.info, index.search.slowlog.threshold.query.debug, index.search.slowlog.threshold.fetch.warn]?"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "unknown setting [index.indexing.slowlog.threshold.query.warn] did you mean any of [index.indexing.slowlog.threshold.index.warn, index.search.slowlog.threshold.query.warn, index.indexing.slowlog.threshold.index.trace, index.indexing.slowlog.threshold.index.info, index.indexing.slowlog.threshold.index.debug, index.search.slowlog.threshold.query.trace, index.search.slowlog.threshold.query.info, index.search.slowlog.threshold.query.debug, index.search.slowlog.threshold.fetch.warn]?",
        "suppressed": [
            {
                "type": "illegal_argument_exception",
                "reason": "unknown setting [index.indexing.slowlog.threshold.fetch.warn] did you mean any of [index.indexing.slowlog.threshold.index.warn, index.search.slowlog.threshold.fetch.warn, index.indexing.slowlog.threshold.index.trace, index.indexing.slowlog.threshold.index.info, index.indexing.slowlog.threshold.index.debug, index.search.slowlog.threshold.fetch.trace, index.search.slowlog.threshold.fetch.info, index.search.slowlog.threshold.fetch.debug, index.search.slowlog.threshold.query.warn]?"
            }
        ]
    },
    "status": 400
}
@TheFireCookie TheFireCookie added the 8.x Relates to a 8.x client version label Jul 28, 2023
@flobernd
Copy link
Member

flobernd commented Aug 3, 2023

@TheFireCookie

The fetch and query settings are invalid for indexing.slowlog as described here:
https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-slowlog.html

These settings are part of the search.slowlog namespace instead and can be configured like this:

var x = new CreateIndexRequestDescriptor<int>("test")
    .Settings(s => s
        .IndexingSlowlog(d => d
            .Threshold(t => t
                .Index(f => f.Warn(TimeSpan.FromSeconds(5)))))
        .Search(x => x
            .Slowlog(x => x
                .Threshold(x => x
                    .Query(f => f.Warn(TimeSpan.FromSeconds(5)))
                    .Fetch(f => f.Warn(TimeSpan.FromSeconds(1)))))));

Please let me know if that solves your problem. I'll add a note on my internal TODO list in order to remove the invalid properties from the descriptor.

@TheFireCookie
Copy link
Contributor Author

Perfect, it's working like that for me. I'm sometimes having issues to find those informations in the generated client. Do you have a documention somewhere or should I have took a direct look at the code to find? (because I searched for that but I assumed that it would be "SearchSlowlog" since it was "IndexingSlowlog". And yeah I agree that cleaning non valid APIs would be helpful, thanks! You can close the ticket :)

@flobernd
Copy link
Member

flobernd commented Aug 3, 2023

We are actively working on improving the documentation, but a lot of parts are not very well documented at the moment - like in this case where I had to check the code instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.x Relates to a 8.x client version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants