search - Limiting top score results returned based on conditional (same value of a field) ElasticSearch Aggregations -


Is there any way to draw only the top 2 results based on _score for documents with the same value in a certain area? ?

This filter will be like hit before bulging:

  {"_index": "myindex", "_score": 100, "_source": {"myfield1 "I have a twin", "name": "Fred"}}, {"_index": "myindex", "_score": 50, "_source": {"myfield1": "I have twins" " Name ":" George "}}, {" _index ":" myindex "," _score ": 10," _source ": {" myfield1 ":" I have a twin "," name ":" tom "}} After this filter / AGG, I want it ... removed the tame because my field 1 has the same value for the "name": "band"}}   "," 

, But the lowest score. Doug lives because he has a different value for my field 1.

  {"_index"}: "myindex", "_score": 100, "_source": {"myfield1": "I have a twin", "name": "freed"} }, "name": "dind", "name": "myindex", "_score": 50, "_source": {"myfield1": "I have a twin", "name": "George"} "doug I was expecting that it would have the right effect ... but it did not happen. Am I shutting down?  
    

To ensure that you receive only 2 replies for the given question, make sure to include the parameter" size ": 2 out of Eggs (in your example Queries and levels similar to Eggs) Parameter ES Size How much you want answers (i.e. how many search results you request ), Which should be for your first part 2. then

"query": {...},

... other stuff ..., : 2

You should get 2 hits for the given question (your first hit).

Besides, I'm not sure, but it seems that you want to search for documents and return documents (your desired example results indicate this) If so, then you Aggregation is not required, only search results

So basically you can try sending only two different search requests using multi_search endpoint ()

Hope that helps

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -