question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Request: Better example of how to use negation with query_string

See original GitHub issue

I’ve been trying to write a filter where I negate a large portion of the potential results AND match the remaining results by looking for a particular string, but I can’t seem to get it to work unless I do this all within a query_string. This is fine for now, but I would like to use more complicated queries in the future and avoid using a 100 character plus long query for readability.

I did notice that none of the examples in the docs seem to combine the two, so is this just not supported at all?

The latest iteration of my attempt at getting this to work is this:

filter:
- and:
  - query:
      query_string:
        query: "fooBarBaz"
  - not:
    - term:
        someField: "badValue"

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Qmandocommented, Oct 31, 2018
filter:
 - query:
      query_string:
        query: "\"stringToSearchFor\" AND NOT integerField: 0"
0reactions
amolkekancommented, Oct 31, 2018

Oops, I made a mistake and didn’t catch this before. Try this instead (remove - from term)

filter:
- query:
    query_string:
      query: "\"stringToSearchFor\""
- not:
     term:
       integerField: 0

how to use multiple comparision in single line

Read more comments on GitHub >

github_iconTop Results From Across the Web

REST API Design Best Practices for Parameter and Query ...
There are many ways in HTTP to add parameters to our request: the query string, the body of POST, PUT and PATCH requests,...
Read more >
Is using a query string in POST request a bad practice?
Is it a bad practice to use query strings for POST requests, and if there any negative consequences of using that from security...
Read more >
Request.QueryString Collection - Microsoft Learn
The QueryString collection retrieves the values of the variables in the HTTP query string. The HTTP query string is specified by the values ......
Read more >
REST API Best Practices for Parameter and Query String Usage
The most common APIs employ HTTP requests to access and use data and ... Array and Map Parameters; When Should the Query String...
Read more >
query-string - npm
Install. npm install query-string. Not npm install querystring !!!!! For browser usage, this package targets ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found