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

Adds support for wildcards in selected fields #7061

Closed

Conversation

Projects
None yet
3 participants
@alexksikes
Copy link
Contributor

alexksikes commented Jul 28, 2014

This could useful to generate all term vectors or a chosen set of them.

Term Vectors API: generate all possible TVs of a document
This commit simply adds the option to retrieve or generate all possible term
vectors of a document, without having to specify a set of selected fields.
This could be useful for MLT with items, for example, to provide a nice
default if users do not specify any field.
@jpountz

This comment has been minimized.

Copy link
Contributor

jpountz commented Jul 30, 2014

The change looks good but I think it would be more consistent with other APIs to accept wildcards in field names than having a generate_all flag? (See eg. http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html#_literal_fields_literal_and_per_field_boosting)

@jpountz jpountz removed the review label Jul 30, 2014

@@ -339,7 +339,7 @@ public void writeTo(StreamOutput out) throws IOException {
public static enum Flag {
// Do not change the order of these flags we use
// the ordinal for encoding! Only append to the end!
Positions, Offsets, Payloads, FieldStatistics, TermStatistics;
Positions, Offsets, Payloads, FieldStatistics, TermStatistics, GenerateAll;

This comment has been minimized.

Copy link
@jpountz

jpountz Jul 30, 2014

Contributor

Shouldn't be needed anymore?

@@ -48,7 +48,8 @@

@Inject
public TransportMultiTermVectorsAction(Settings settings, ThreadPool threadPool, TransportService transportService,
ClusterService clusterService, TransportSingleShardMultiTermsVectorAction shardAction, ActionFilters actionFilters) {
ClusterService clusterService, TransportSingleShardMultiTermsVectorAction shardAction,
ActionFilters actionFilters) {

This comment has been minimized.

Copy link
@jpountz

jpountz Jul 30, 2014

Contributor

Can you undo the change on this file?

}
} else {
fieldNames.add(pattern);
}

This comment has been minimized.

Copy link
@jpountz

jpountz Jul 30, 2014

Contributor

Is the if necessary? It seems to me that the following should work?

for (String pattern : request.selectedFields()) {
    fieldNames.addAll(indexShard.mapperService().simpleMatchToIndexNames(pattern));
 }

This comment has been minimized.

Copy link
@jpountz

jpountz Jul 30, 2014

Contributor

Additionally maybe fieldNames should be a set in case several patterns match the same field names?

@jpountz

This comment has been minimized.

Copy link
Contributor

jpountz commented Jul 30, 2014

@alexksikes left some comments

@jpountz

This comment has been minimized.

Copy link
Contributor

jpountz commented Jul 30, 2014

LGTM

@jpountz jpountz removed the review label Jul 30, 2014

alexksikes added a commit that referenced this pull request Jul 30, 2014

Term Vectors API: adds support for wildcards in selected fields
This could useful to generate all term vectors or a chosen set of them.

Closes #7061

alexksikes added a commit that referenced this pull request Sep 8, 2014

Term Vectors API: adds support for wildcards in selected fields
This could useful to generate all term vectors or a chosen set of them.

Closes #7061

@clintongormley clintongormley changed the title Term Vectors API: generate all possible TVs of a document Term Vectors: Fenerate all possible TVs of a document Sep 8, 2014

@alexksikes alexksikes changed the title Term Vectors: Fenerate all possible TVs of a document Term Vectors: Generate all possible TVs of a document Sep 16, 2014

@alexksikes alexksikes deleted the alexksikes:feature/termvectors-generate-all branch Oct 1, 2014

@alexksikes alexksikes changed the title Term Vectors: Generate all possible TVs of a document Term Vectors API: adds support for wildcards in selected fields Oct 1, 2014

@clintongormley clintongormley changed the title Term Vectors API: adds support for wildcards in selected fields Adds support for wildcards in selected fields Jun 7, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.