Skip to content

Conversation

@mccool
Copy link

@mccool mccool commented Dec 7, 2021

Add the ability to pass in a type to the query string query. It can be used just all the other options available on the queryStringQuery .type('most_fields')

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-multi-field-parms

* `best_fields`.
* @returns {QueryStringQuery} returns `this` so that calls can be chained.
*/
type(type) {
Copy link
Owner

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Should we just have an enum for these type values? They are duplicated in the multi match query. Also in the .js files these values are duplicated. How do you want to handle this?

Copy link
Owner

Choose a reason for hiding this comment

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

Could you clarify what you mean by an enum? The source is not using Typescript yet.

They are duplicated in the multi-match query.

Yes, we could re-use MULTI_MATCH_TYPE defined in the src/core/consts.js file.

Copy link
Author

Choose a reason for hiding this comment

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

I've been a bit busy but will get to this soon. I have also found 1 more area that I want to improve and will just include it with this PR since as well.

I'll get some changes pushed up next week to get this (hopefully) approved and released.

* - `phrase_prefix` - Runs a `match_phrase_prefix` query on each field
* and combines the `_score` from each field.
*
* - `bool_prefix` - Creates a match_bool_prefix query on each field and
Copy link
Owner

Choose a reason for hiding this comment

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

I think this type was not available in Elasticsearch v6 - https://www.elastic.co/guide/en/elasticsearch/reference/6.8/query-dsl-multi-match-query.html#multi-match-types

Could we add a note regarding the same? If you can identify the exact version that it was added in, that would be great.

* `best_fields`.
* @returns {QueryStringQuery} returns `this` so that calls can be chained.
*/
type(type) {
Copy link
Owner

Choose a reason for hiding this comment

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

As far as I can see, this option was added only in Elasticsearch v6 based on the docs for v5. Can we add a note calling out the same?

@sudo-suhas
Copy link
Owner

@mccool would you be able to work on the requested changes?

@mccool
Copy link
Author

mccool commented Nov 1, 2022

@sudo-suhas I think I'll be able to get back to this in about a week or two.

@sudo-suhas
Copy link
Owner

Thanks @mccool, that would be great.

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

Successfully merging this pull request may close these issues.

2 participants