Search in type with one attribute as null or empty

Hi All,

I am using elastic search java api. We have indexed data as

GET eb_portal_index/part/_search
"query": {
"match": {
"part_no": "ME9143"

We get result like

"took": 16,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
"hits": {
"total": 1,
"max_score": 11.686213,
"hits": [
"_index": "eb_portal_index",
"_type": "part",
"_id": "ME9143/0.0/null/null/null",
"_score": 11.686213,
"_source": {
"part_no": "ME9143",
"min_stock_qty": 0,
"latest_price": 0,
"latest_leadtime": 0,
"indexES": "part ME9143/00 IHC7_Part",
"revision": "00",
"type": "IHC7_Part",
"object_name": "ME9143",
"object_desc": "BB4026DU",
"owning_group": "Engineering",
"uom_tag": "each",
"last_release_status": "Released",
"date_released": "2015-01-22T00:00:00.000+01:00",
"last_mod_user": "Migrator (migrator)",
"ihc7_discipline": "Mechanical",
"ihc7_manufacturer": "",
"ihc7_manufacturerref": "",
"bom_qty": 0,
"bom_price": 0,
"bom_price_total": 0

Now I want to search all part in that index, which have object_desc as empty or null , or object_desc is not set for that part. Is it possible. How can i do in java

You can search using exists query inside a must_not clause, see

Exists Query in Java API :
And Bool Query :

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