Function score, script and JAVA API

Hi,

I am quite new with the Java API, and I am trying to "translate" a request to this API :

POST /real_customers_5000/_search
{
   "size": 1000,
   "min_score": 0.1,
   "query": {
      "function_score": {
         "query": {
            "bool": {
               "should": [
                  {
                     "term": {
                        "BIRTH_DATE": "06/06/1971"
                     }
                  },
                  {
                     "term": {
                        "BIRTH_DATE": ""
                     }
                  }
               ],
               "minimum_should_match": 1
            }
         },
         "functions": [
            {
               "script_score": {
                  "script": {
                     "inline": "my_script",
                     "lang": "native",
                     "params": {
                        "fields": [
                           
                           {
                              "field": "MAIL_PERS",
                              "value": "jccouvy@yahoo.fr",
                              "cleaners": [
                                 {
                                    "name": "no.priv.garshol.duke.cleaners.RegexpCleaner",
                                    "params": {
                                       "regexp": "^([a-z0-9]+(?:[._-][a-z0-9]+)*)@([a-z0-9]+(?:[.-][a-z0-9]+)*\\.[a-z]{2,})$"
                                    }
                                 }
                              ],
                              "high": 0.838648094381669,
                              "comparator": {
                                 "name": "no.priv.garshol.duke.comparators.Levenshtein"
                              },
                              "low": 0.32794743090493866
                           },
                           {
                              "field": "BIRTH_DATE",
                              "value": "06/06/1971",
                              "cleaners": [
                                 {
                                    "name": "no.priv.garshol.duke.cleaners.LowerCaseNormalizeCleaner"
                                 }
                              ],
                              "high": 0.82,
                              "comparator": {
                                 "name": "no.priv.garshol.duke.comparators.ExactComparator"
                              },
                              "low": 0.0
                           }
                        ]
                     }
                  }
               }
            }
         ]
      }
   }
}

Of course, I tried searching on google and in the forum, but the results are either outdated or too different.
This request uses this plugin (which I adapted for ES 5.4). I hope someone could find a solution...
Thanks in advance !

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