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

How to use operators in query? #1094

Open
jornkers opened this issue Dec 10, 2024 · 1 comment
Open

How to use operators in query? #1094

jornkers opened this issue Dec 10, 2024 · 1 comment
Labels
question Further information is requested

Comments

@jornkers
Copy link

Hi there,

So far the library is holding up really well!

One thing we're looking into is how to use operators in the query.
For example we have documents named ABC 210 and ABC 211.

When we search from ABC 210, not only 210 returns from Elastic, but also 211.

How can we implement an AND feature or something else to narrow down the result?

Thanks in advance!

Grts,
Jorn

@jornkers jornkers added the question Further information is requested label Dec 10, 2024
@yansavitski
Copy link
Contributor

Hey
You can modify the request body in the connector. Doc

requestBody.query = {
        multi_match: {
          query: requestState.searchTerm,
          operator: queryConfig.query?.operator || "AND",
          fields: Object.keys(searchFields).map((fieldName) => {
            const weight = searchFields[fieldName].weight || 1;
            return `${fieldName}^${weight}`;
          })
        }
      };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants