I am using Kibana version v7.13.2.
I am trying to search for messages carrying the phrase "amount":"3000","taxRate"
where the amount value ranges from 3000 to 3999.
I am using the following Lucene Query:
message:amount /3[0-9]{3}/ taxRate
The query works and fetches the following:
"amount":"3100","taxRate"
"amount":"200","taxRate"
"amount":"3983","taxRate"
"amount":"3100"
"taxRate"
"amount"
"3100","taxRate"
"amount":"3100","trxFee":"90","taxRate"
Means the query is working with OR condition. It fetches the messages if there is word amount OR the number ranging from [3000-3999] OR the word "taxRate".
I want to modify the query to search for messages where ALL THREE PATTERNS exist together IN THAT SPECIFIC ORDER, i.e. first amount second amount value and finally the word taxRate
So with the correct query, the following resultSet would appear only:
"amount":"3100","taxRate"
"amount":"3983","taxRate"
Kindly help.
Related
I want to compare a sales orders' items to our route packing items, I am able to do the individual records, but in order to limit the search how I was hoping I need it to be aggregate? Sorry I'm not familiar with this concept. Something like this is what I had come up with:
CASE WHEN COUNT({item} = [custrecord_rfs_ms_salesorder_1.custrecord_rfs_ms_item]) > 0 THEN 1 ELSE 0 END
I apologize if I am completely off base, it made sense when I wrote it lol.
Go back to the saved search where you were able to do the individual records. If you have "too many" results or if it's taking to long to load try the following (separately or together...):
Add limiting criteria to the search, and you can also add as filter to allow users to change. Ex: Date is within "this month" as criteria and Date as filter.
Use NS Saved Search native features to aggregate results. Ref Suite Answers 8423, 20995, and 8445.
So here is what I am trying to do.
I have a facet defined on the price field.
1) When there is a query for "wordA"
I want the facets to be from 0-1000 divided in 5 intervals since my maximum price for "wordA" will never exceed 1000
2) When there is a query for "wordB"
I want the facets to be from 0-50 divided in 5 intervals since my maximum price for the query "wordB" will never exceed 50.
So basically I want the facet range to change dynamically so that I don't end up with a range of 0-1000 for a query "wordB" where all the hits will lie in the 1st range.
If solr does not support this then it will be a lot of query post processing involved to modify the ranges based on the returned results.
Solr does not support that, but you can do it yourself by doing two queries - first get the stats (max, min) for the field, then submit a query for the facet ranges (intervals) that are suitable for your application.
I have an access form with few controls on it, like start-date, end-date, move_type, mover_name etc, when user fills this field n clicks on query command button, a select query is run and it fetches records from various tables depending upon the criteria mentioned by the user.
Later the same records are exported to excel file and a report is generated for user.
Now I need to do more with this, my select query has a field "quoted-price", depending upon the price quoted the records need to be sorted out.
EX : if quoted_price < 500 then it is a "domestic apartment1", if quoted-price is >500 And <1500 it is "domestic Apartment1" etc.
Now I need to do more with this, my select query has a field "quoted-price", depending upon the price quoted the records need to be sorted out.
EX : if quoted_price < 500 then it is a "domestic apartment1", if quoted-price is >500 And <1500 it is "domestic Apartment1" etc. and when all the records generated through select query are searched on this criteria, the records need to be grouped accordingly. Later the count for individual category is multiplied by a unit value and total charge is calculated.
I tried building many queries to do this and tables to refer to value but of no use. Any help will be much appreciated.
are you looking to create a new field depending on the condition? That may be step one of what you are trying to do, If so that is pretty easy. See here: http://allenbrowne.com/casu-14.html
I am having a problem trying to achieve the following:
I'd like to have a page with 'infinite' scrolling functionality and all the results fetched to be sorted by certain attributes. The way the code currently works is, it places the query, sorts the results, and displays them. The problem is, that once the user reaches the bottom of the page and new query is placed, the results from this query are sorted, but in its own context. That is, if you have a total of 100 results, and the first query display only 50, then they are sorted. But the next query (for the next 50) sorts the results only based on these 50 results, not based on the 100 (total results).
So, do I have to fetch all the results at once, sort them, and then apply some pagination logic to them or there's a way for MongoDB to actually have infinite scrolling (AJAX requests) with sorting applying to the results?
There's a few ways to do this with MongoDB. You can use the .skip() and .limit() commands (documented here: http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-CursorMethods) to apply pagination to the query.
Alternatively, you could add a clause to your query like: {sorted_field : {$gt : <value from last record>}}. In other words, filter out matches of the query whose sorted value is less than that of the last resulting item from the current page of results. For example, if page 1 of results returns documents A through D, then to retrieve the next page 2 you repeat the same query with the additional filter x > D.
Let me preface this by saying that I have no experience with MongoDB (though I am aware that it is a NoSQL database).
This question, however, is somewhat of a general database one (you'd probably get more responses tagging it as such). I've implemented such a feature using Cassandra (another, albiet quite different NoSQL database), however the same principles apply.
Use the sorted-by attribute of the last retrieved record, and conduct a range search based on it in the database. So, assuming your database consists of the following set of letters:
A
B
C
D
E
F
G
..and you were retrieving 2 letters at a time, you'd retrieve A, B first. When more records are needed, you'd use B to conduct a range search on the set of letters in the database. In plain English this would be something like:
Get the letters that appear after B, limit the results to 2
From a brief look at the MongoDB tutorial, it looks like you have conditional operators to help you implement this.
I want to search in multiple fields in Solr.
(In know the concept of the copy-fields and I know the (e)dismax search handler.)
So I have an orderd list of fields, I want the terms to be searched against.
1.) SKU
2.) Name
3.) Description
4.) Summary
and so on.
Now, when the query matches a term, let's say in the SKU field, I want this match and no further searches in the proceeding fields.
Only, if there are NO matches at all in the first field (SKU field), the second field (in this case "name") should be used and so on.
Is this possible with Solr?
Do I have to implement my own Lucene Search Handler for this?
Any advice is welcome!
Thank you,
Bernhard
I think your case requires executing 4 different searches. If you implement you very own SearchHandler you could avoid penalty of search result accumulation in 4 different request. Which means, you would send one query, and custom SearchHandler would execute 4 searches and prepare one result set.
If my guess is right you want to rank the results based on the order of the fields. If so then you can just use standard query like
q=sku:(query)^4 OR name:(query)^3 OR description:(query)^2 OR summary:(query)
this will rank the results by the order of the fields.
Hope is helps.