JSON logging and collection/shard/replica

2024-04-08 Thread Morten Bøgeskov
Hello.

This might not be the right place to ask this (maybe log4j?), however my 
question goes:

I would like a JSON log format. I'm looking at 
https://logging.apache.org/log4j/2.x/manual/json-template-layout.html And can't 
figure out how to access the fields referred in:

  %maxLen{%d{-MM-dd HH:mm:ss.SSS} %-5p (%t) 
[%notEmpty{c:%X{collection}}%notEmpty{ s:%X{shard}}%notEmpty{ 
r:%X{replica}}%notEmpty{ x:%X{core}}%notEmpty{ t:%X{trace_id}}] %c{1.} 
%m%notEmpty{ =>%ex{short}}}{10240}%n


as collection/shard/replica. When I use resolver "mdc" (As I understand X to be 
from https://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout) in 
my JSON template I get:
{"core":"corepo","rid":"null-5","trace_id":"null-5"}
Any thoughts on how to log those?

It would be awfully useful to know, if one replica is significantly slower that 
the others in same shard (to monitor disk degradation).

\Morten


Re: JSON logging and collection/shard/replica

2024-04-08 Thread Chris Hostetter


If you are getting any values from the MDC resolver, then you have the MDC 
resolver configured correctly.

You're only going to get MDC values like collection/shard/replica if those 
are defined for the thread that logged the message you are looking at.

In the specific example you posted...

: {"core":"corepo","rid":"null-5","trace_id":"null-5"}

...thta "core" name does not look like a a core name that solr would have 
created in solr cloud mode -- it looks like maybe you are just running a 
trivial example solr instance where you manually created a core? ... in 
which case there is no collection/shard/replica data to include in the MDC 
for that request.



-Hoss
http://www.lucidworks.com/


Re: Using min/max value of field in boost query

2024-04-08 Thread Chris Hostetter


Check the docs for min & max functions -- they don't do what you seem to 
think they do...

https://solr.apache.org/guide/solr/latest/query-guide/function-queries.html#max-function

>> Returns the maximum numeric value of multiple nested functions or 
>> constants, which are specified as arguments: max(x,y,...)

They also both have a pointer to the function that does do what you 
want...

>> Use the field(myfield,max) syntax for selecting the maximum value of a 
>> single multivalued field.

https://solr.apache.org/guide/solr/latest/query-guide/function-queries.html#field-function



: Date: Tue, 2 Apr 2024 12:34:42 +0530
: From: govind nitk 
: Reply-To: users@solr.apache.org
: To: users@solr.apache.org
: Subject: Using min/max value of field in boost query
: 
: Hi,
: 
: currently a working solution is like:
: 1. First api call - take min, max value of numeric fields say price field
: 2. In another api call to solr use it like
: bq="div(sub(price,min_price),sub(max_price,sum(1,min_price)))^0.05"
: 
: above is a working solution, but its two api based.
: Can we use the min/max values in boost using function queries ?
: 
: I tried with local param reference
: ex.
: 
min_price=min(price)&max_price=max(price)&bq="div(sub(price,$min_price),sub($max_price,sum(1,$min_price)))^0.05"
: 
: This is not giving an error, but min_price is the same as price; so
: sub(price,min_price) is zero and boost finally applied is zero.
: 
: Is there any option to achieve this?
: 

-Hoss
http://www.lucidworks.com/


Community Over Code NA 2024 Search track, CFP closing soon

2024-04-08 Thread Anshum Gupta
Hi folks,

The CFP for *“Community Over Code 2024”* (previously known as ApacheCon) is
currently open until *15th Apr 2024 *for folks who’re interested in
submitting talks. Like the previous years we have the '*Search' track* for
folks who want to talk about their Search stories.

Please submit your talks here -
https://communityovercode.org/call-for-presentations/

We hope to see many of you talk about Search in Denver!

-- 
Anshum Gupta