Skip to content

Conversation

@tlrx
Copy link
Member

@tlrx tlrx commented Aug 28, 2017

This pull request converts some more remaining doc snippets so that they are now testable.

Note: I think it's perfectly fine to have some // NOTCONSOLE here and there as long as they are associated to an explanation on why it cannot be tested.

This commit converts some remaining doc snippets so that they are now
testable.
@tlrx tlrx added >docs General docs changes review >test Issues or PRs that are addressing/adding tests v6.0.0 v7.0.0 v6.1.0 labels Aug 28, 2017
]
},
{
"name": "BucketCollector: [[org.elasticsearch.search.profile.aggregation.ProfilingAggregator@222b076, org.elasticsearch.search.profile.aggregation.ProfilingAggregator@3000ab31]]",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ProfilingAggregator.toString() changed? I'd expect to find the name here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I bet it did. This would have caught that it broke user output too.... Might be a nice followup I think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, not sure what's going on here. I don't think ProfilingAggregator ever overrode toString() (at least I don't see it in the history anywhere), so I'm not sure how this worked before either :)

In either case we should just delegate to the wrapped collector's name. I'll investigate and open an issue/PR if appropriate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In either case we should just delegate to the wrapped collector's name. I'll investigate and open an issue/PR if appropriate.

Thanks @polyfractal :)


1. The first `TermQuery` (message:search) represents the main `term` query
2. The second `TermQuery` (my_field:foo) represents the `post_filter` query
3. There is a `MatchAllDocsQuery` (\*:*) query which is being executed as a second, distinct search. This was
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MatchAllDocsQuery does not appear in the original search query, neither in the updated one. I think the explanation is now obsolete but I'd be happy if someone can confirm/infirm this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kinda odd... I think we have to execute a secondary collector for the global agg (since the first is being filtered by the query).

I think modifying the docs right now is fine, but I'll start chasing why this changed because it could be something wrong with the profiler itself.

Copy link
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't comment on the profiling snippets. Maybe @polyfractal can have a look?

]
}
--------------------------------------------------
// NOTCONSOLE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd originally thought of // NOTCONSOLE as only for requests that looked like they should be converted to // CONSOLE but can't for some reason, like maybe we're demonstrating how to use curl in the _bulk API.

While the name // NOTCONSOLE isn't really right for this the idea makes sense. We can't assert anything about this response.

So I'm 👍 on doing this here.

"failures" : [ ]
}
--------------------------------------------------
// NOTCONSOLE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can actually test this and the advantage of doing so is that we'll catch if the output of reindex changes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, this snippet is really out of date

"failures" : [ ]
}
--------------------------------------------------
// NOTCONSOLE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can test this too.

[source,js]
--------------------------------------------------
PUT /my_index
PUT index
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've mostly been starting with the / before the first element so it feels more like a url. At first I liked it better without but @clintongormley liked it better with so I went with his way and I've grown used to it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly we're not coherent in the docs. I changed it here so that it is coherent on the same page.


[source,js]
--------------------------------------------------
PUT index/_settings
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just put the POST /index/_close request in the snippet so the users sees it. We tell them to close but it is a fine reminder of how.

}
}
}
--------------------------------------------------
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could even add an _open here.

Creating new empty translog at [data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-3.tlog]
Done.
--------------------------------------------------
// NOTCONSOLE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I'd change the snippet from [source,js] to [source,txt] which will cause it to skip the detection so you don't need // NOTCONSOLE.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I don't remember why I added this NOTCONSOLE

]
},
{
"name": "BucketCollector: [[org.elasticsearch.search.profile.aggregation.ProfilingAggregator@222b076, org.elasticsearch.search.profile.aggregation.ProfilingAggregator@3000ab31]]",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I bet it did. This would have caught that it broke user output too.... Might be a nice followup I think.

...
"aggregations": [
{
"type": "org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory$1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there are more naming issues to iron out in the profiler :(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs tests are lovely, aren't they? :)

@polyfractal
Copy link
Contributor

polyfractal commented Aug 28, 2017

Profiler stuff looks fine to me. There are some oddities for sure, but not a problem with the docs... likely issues with the profiler code itself. I'll chase those down. Thanks for adding these tests @tlrx!

@nik9000
Copy link
Member

nik9000 commented Aug 29, 2017

Thanks for doing this!

@tlrx tlrx merged commit db54c4d into elastic:master Aug 30, 2017
@tlrx
Copy link
Member Author

tlrx commented Aug 30, 2017

Thanks @nik9000 @polyfractal

tlrx added a commit that referenced this pull request Aug 30, 2017
This commit converts some remaining doc snippets so that they are now
testable.
tlrx added a commit that referenced this pull request Aug 30, 2017
This commit converts some remaining doc snippets so that they are now
testable.
@tlrx tlrx deleted the more-docs branch August 30, 2017 08:18
@lcawl lcawl removed the v6.1.0 label Dec 12, 2017
@jimczi jimczi added v7.0.0-beta1 and removed v7.0.0 labels Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>docs General docs changes >test Issues or PRs that are addressing/adding tests v6.0.0-rc1 v7.0.0-beta1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants