Hi,

i have products in my index and i would like to sort them by the lowest 
price of a client. I think i have to use a function_score for that?

//Product Mapping
{
    ArticleNumber: 1000,
    Title: "sample product",
    Clients: [
        {
            Type: "K",
            Price: 10,
            ClientIds: [
                1,
                2
            ]
        },
        {
            Type: "K",
            Price: 9,
            ClientIds: [
                3
            ]
        }
    ],
}

Currently my query looks like this. But i don't know how i can iterate over 
the nested "Clients" Objects and get the lowest price for the Client with 
the Id 1.

query: {
    function_score: {
            boost_mode: "replace",
            query: {
                match_all: { }
            },
            functions: [
                {
                    script_score: {
                        script: "miss script to iterate over the Clients",
                        lang: "groovy"
                    }
                }
            ]
    }
}

Any help would be appreciated.


-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/8f42c4e6-7706-4d8d-9105-ac1fda1ed43c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to