Elasticsearch-dsl-py: Can't use query with null value

Created on 23 Oct 2017  路  1Comment  路  Source: elastic/elasticsearch-dsl-py

Hi, I would like to find the result of which object an specific value is null.

Q('match', test__pk= None )
It shows TransportError(400, u'parsing_exception', u'No text specified for text query')

how can i solve it?

Most helpful comment

If you wish to looks for a null/None value please use a negation of the exists query: ~Q('exists', field='test.pk').

The reason for that is that null/None values don't get stored in the index so the engine treats them as missing.

Hope this helps,
Honza

>All comments

If you wish to looks for a null/None value please use a negation of the exists query: ~Q('exists', field='test.pk').

The reason for that is that null/None values don't get stored in the index so the engine treats them as missing.

Hope this helps,
Honza

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rokcarl picture rokcarl  路  4Comments

mortada picture mortada  路  3Comments

MauriJHN picture MauriJHN  路  4Comments

vmogilev picture vmogilev  路  4Comments

gabrielpjordao picture gabrielpjordao  路  3Comments