Page 1 of 1
How to query for exact string with nothing more?
Posted: Wed Oct 30, 2019 3:42 pm
by Sampath.Basireddy
I have a requirement to query and filter for an exact string with nothing more.
The messages has the exact string what I am looking for and some message has more text next to it, but I want to filter for only the string I am looking for.
Any way around this?
Thank You,
Re: How to query for exact string with nothing more?
Posted: Wed Oct 30, 2019 4:07 pm
by mbellerue
Here's a good tutorial on the syntax for Lucene query.
http://www.lucenetutorial.com/lucene-query-syntax.html
However, if you just need to filter out messages with that additional text, and that additional text is reliable, you can put this in your query.
Code: Select all
message: "I want this" -message: "But not this"
Re: How to query for exact string with nothing more?
Posted: Thu Oct 31, 2019 1:32 pm
by Sampath.Basireddy
Thanks
@mbellerue.
What is I have a lot of messages that I want to filter out?
Here is an example:
Messages:
- NagiosXI Enterprise Server and Network Monitoring Software NagiosXI
- NagiosXI is Enterprise Server and Network Monitoring Software
- NagiosXI
If I have to filter the messages that has just "NagiosXI" and nothing more?
Re: How to query for exact string with nothing more?
Posted: Thu Oct 31, 2019 1:47 pm
by mbellerue
It's not a perfect solution for sure. For your exact example, you can look for common words. If you wanted just the NagiosXI message, you could do this,
Code: Select all
message: "NagiosXI" -message: "Enterprise"
Since both of the other messages have Enterprise in them, they should be stopped by the second part of the filter.
Re: How to query for exact string with nothing more?
Posted: Tue Nov 05, 2019 11:59 am
by Sampath.Basireddy
Thanks
@mbellerue.
This may not necessarily help with my requirement, but may be to an extent.
Does this "-message" accept wild cards?
Re: How to query for exact string with nothing more?
Posted: Tue Nov 05, 2019 12:17 pm
by mbellerue
Yes, it will do wildcards.
Re: How to query for exact string with nothing more?
Posted: Wed Nov 06, 2019 11:58 am
by Sampath.Basireddy
Thanks
@mbellerue.
You may close this thread.