Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing/exists filters should also work for objects #3141

Closed
spinscale opened this Issue Jun 6, 2013 · 3 comments

Comments

Projects
None yet
3 participants
@spinscale
Copy link
Member

spinscale commented Jun 6, 2013

The missing filter is not working, when the field expected to be missing is an object. Consider this sample

curl -X DELETE http://localhost:9200/test

curl -XPUT 'http://localhost:9200/test/test/3?refresh=true' -d '{
    "foo" : {
        "bar" : "baz"
    }
}'

curl -XPOST "http://localhost:9200/test/_search?pretty" -d '{
    "filter" : {
        "missing" : {
            "field" : "foo"
        }
    }
}'

This could be implemented by checking the mapping for the type to be queried and create a bool filter full of missing filters, when the mapping shows an object type.

This feature also supports wildcards notation, for example obj1.obj2.field_pre*.

@ghost ghost assigned kimchy Jun 6, 2013

@kimchy

This comment has been minimized.

Copy link
Member

kimchy commented Jun 12, 2013

Going to push the change to this one soon, note, this improvement will only work for objects that have fields that are indexed within it to check if it exists or missing...

@kimchy kimchy closed this in c449fbd Jun 12, 2013

kimchy added a commit that referenced this issue Jun 12, 2013

@philayres

This comment has been minimized.

Copy link

philayres commented Jun 12, 2013

I'm pleased I searched before raising an issue of my own. You say this will only work for "objects that have fields that are indexed within". Am I correct in understanding that the only case this does not cover is if all fields within an object are marked as 'not indexed' in mappings? Or will it also exclude an object only containing other objects (i.e. no discrete indexed fields).

Looking forward to trying this out on my test server soon.

@kimchy

This comment has been minimized.

Copy link
Member

kimchy commented Jun 12, 2013

@philayres yes, if all fields within the object are marked as not indexed, it will regard it as missing.

mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.