Designing array of fields accessible by the Lucene expression language scripts


#1

Hi everybody!

I'm trying to design index and type(s) for my app and I stuck. For example this would be simplified solution to my problem:

{
    "script_fields": {
        "test_field": {
            "script": {
                "params": {
                    "param1": 2
                },
                "inline": "doc['object1.field1'].value * param1",
                "lang": "expression"
            }
        }
    }
}

and there would haven't been this thread just if that had worked for the 'object1' being a nested field.

After searching for answers I came up with 'copy_to' directive at indexing time as better than soon deprecated 'include_in_parent'. But still, afaik, those directives will flatten my nested fields for the purpose and that can't be a solution as I need particular calculations for the elements of the array. Parent-child relations could be the answer - I'm totally fine with the single shard - but I want to be sure I'd squeeze the most from the engine. :slight_smile:

I should have kind of parent document having relation to one or more "children" or nested documents and each of those children documents affect the custom scoring I'm going to implement. I'm free to implement any kind of solution and I'm interested in best practices for the future (pre-production is for the last ES 5.x version).

So, in short, I have "parent" document with few array fields and few numeric fields that affect final score, together with one or more similar "children" (or nested docs) that affect score too, and I'm looking for search time speed optimized solution (Lucene expression language is sufficient regarding both implemented math and Boolean calculations and the types of reached document fields).

P.S. I forgot to mention, the whole process would be pre-designed - all the app's mappings, document inserting and searching are predefined.


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.