elasticsearch script query with exists/missing filter -


i trying run script query filter. script should return me books title gt 30:

get books/_search {     "filter" : {                  "script" : {               "script" : "_source.title?.length() > 30"           }       } } 

this works.

but if try add filter, want books not has 'type' field :

get book/_search {     "filter" : {                   "script" : {               "script" : "_source.title?.length() > 30"           },           "missing" : { "field" : "type" },       } } 

then error:

nested: elasticsearchparseexception[expected field name got start_object \"exists\"]; }] 

so can query missing fields script filter?

you're on right track, need combine both of filters bool/must query.

post book/_search {   "filter": {     "bool": {       "must": [         {           "script": {             "script": "_source.title?.length() > 30"           }         },         {           "missing": {             "field": "type"           }         }       ]     }   } } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -