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

Added searching for multiple similar documents #5857

Merged
merged 1 commit into from May 17, 2014

Conversation

alexksikes
Copy link
Contributor

The documents are specified by a list of ids. The index and type where each document is
fetched from is assumed to be the first specified in the URL.

Relates #4075

}
if (exclude != true) {
builder.field("exclude", exclude);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this should use a Boolean instead (the object wrapper) and only write it if not null.

I know the other integers are not doing it, but I think this one is different since true is a valid value while -1 is an invalid value for the other fields.

be specified, but not both. The texts are fetched from `fields` and `fields`
must be specified in this case.

|`_type` |When using `ids`, this disambiguates which type to fetch the
Copy link
Contributor

Choose a reason for hiding this comment

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

since what we do here is essentially a multi get why don't we just support the multi_get syntax and share the parsing code?

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-multi-get.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be nice to support the full multi-get syntax, but note that it would allow users to fetch for documents not found in the index(s)/type(s) specified in the query dsl request. In this case what should be the mlt query? Would it make sense to fetch for apples but ask for bananas? One possibility is to allow these cases though, and clarify the exact usage of this syntax in the documentation.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes I absolutely think we should allow for this. Lets say you have a video search. You have two types adult_videos / non_adult_videos and you do a MLT you might not specify a type in the request but those are essentially the same. It's a bit like ducktyping in dynamic languages IMO

Copy link
Contributor

Choose a reason for hiding this comment

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

we should document the multi get syntax here maybe just put a reference to mget and add an example?

@s1monw
Copy link
Contributor

s1monw commented May 14, 2014

I left some comments but I think it's close... I will remove the review tag, can you put it back once you have a new iteration?

@s1monw
Copy link
Contributor

s1monw commented May 14, 2014

I like it - I think it's ready to go @jpountz do you wanna take another look?

if (item.type() != null) {
builder.field("_type", item.type());
}
builder.endObject();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you need to write the field names as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, and I suppose _routing as well, but not _source.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@jpountz
Copy link
Contributor

jpountz commented May 15, 2014

I left comments/questions but I agree this looks very nice!

}

@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

so what about the other settings you can set on the Item like source filtering? I think we should expose all of them here though.

@s1monw
Copy link
Contributor

s1monw commented May 15, 2014

I left one comment other than that LGTM

}
if (this.routing() != null) {
builder.field("_routing", this.routing());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I am still missing _version, _version_type, fields, and _parent here we should add them!

@s1monw
Copy link
Contributor

s1monw commented May 16, 2014

I did another round sorry for being picky but there is still stuff missing...

@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.field("_index", this.index());
Copy link
Contributor

Choose a reason for hiding this comment

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

index is required? ti can't be null? I saw taht you change this...?

@s1monw
Copy link
Contributor

s1monw commented May 17, 2014

one small comment other than that LGTM

@s1monw
Copy link
Contributor

s1monw commented May 17, 2014

LGTM

The syntax to specify one or more items is the same as for the Multi GET API.
If only one document is specified, the results returned are the same as when
using the More Like This API.

Relates elastic#4075 Closes elastic#5857
@alexksikes alexksikes merged commit db991dc into elastic:master May 17, 2014
alexksikes added a commit that referenced this pull request May 17, 2014
The syntax to specify one or more items is the same as for the Multi GET API.
If only one document is specified, the results returned are the same as when
using the More Like This API.

Relates #4075 Closes #5857
@alexksikes alexksikes removed the review label May 17, 2014
@s1monw s1monw added review and removed review labels May 17, 2014
@clintongormley clintongormley changed the title Added searching for multiple similar documents with More Like This Query... Added searching for multiple similar documents with More Like This Query Jun 6, 2015
@clintongormley clintongormley changed the title Added searching for multiple similar documents with More Like This Query Added searching for multiple similar documents Jun 7, 2015
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :More Like This labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories v1.2.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants