It worked. Thank you very much.

* copying the final code for future referece:

POST test/tst/_search
{
  "query": {
    "function_score": {
      "boost_mode": "replace", 
      "query": {
        "filtered": {
          "query": {
            "match_all": {}
          },
          "filter": {
            "exists": {
              "field": "fsot"
            }
          }
        }
      },
      "functions": [
        {
          "script_score": {
            "script": "if ( doc.get('fsot.testobj') == null ) 0; else 1;"
          }
        }
      ]
    }
  }
}



On Monday, August 25, 2014 12:33:47 AM UTC-3, vineeth mohan wrote:
>
> Hello Pablo , 
>
> Lucene ( the underlying library library on which ES is build upon) has 
> only key value concept and it does not keep object level information.
> This means that on Lucene side , data would be stored as 
>
> fsot.testObjects : [ "test1" , "test2" ] 
>
> And there is not field names as fsot on lucene side.
> This means that you need to give the field name as fsot.testObjects rather 
> than fsot.
>
> Thanks
>              Vineeth
>
>
> On Mon, Aug 25, 2014 at 7:57 AM, Pablo Musa <pabli...@gmail.com 
> <javascript:>> wrote:
>
>> Hey guys,
>> I am trying to use the function score but I am getting the following 
>> error:
>>
>> ElasticsearchIllegalArgumentException[No field found for [fsot] in 
>> mapping with types [tst]];
>>
>> I have used function score before and it worked like a charm so I started 
>> digging what was wrong. I found out that it does not work with object type.
>>
>> Am I doing something wrong? What am I missing here?
>>
>> The following gist contains an example and the error I received.
>> https://gist.github.com/pmusa/ef9a02210d736ee020d9
>>
>> Thanks in advance,
>> Pablo Musa
>>
>> -- 
>> 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 elasticsearc...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/elasticsearch/CAF6PhF%2B5A3XYCHhFm_j-rFuXLAz3tE_xAUCcdV2UbFASwCx52Q%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/elasticsearch/CAF6PhF%2B5A3XYCHhFm_j-rFuXLAz3tE_xAUCcdV2UbFASwCx52Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/bf051fbb-a860-4898-864b-fedb54c8500c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to