Update null_value property

(Flavio Tom) #1

I created a new property in my mapping, with the following characteristics.

  "allow_to_buy": {
    "type": "text",
    "fields": {
      "keyword": {
        "type": "keyword",
        "null_value": "N",
        "ignore_above": 256

To update the documents I used the function update by query.



However, even looking for the new property when the value is N, nothing returns.

    "size": 1000,
    "query": {
        "term": {
            "allow_to_buy.keyword": {
                "value": "N",
                "boost": 1.0

What should I do?

(Alexander Reelsen) #2

can you show a sample document? The null_value feature only works, if the field is part of your JSON but explicitely marked as null, i.e. foo: null - if the field does not exist, than this will not work. You would need to write a small script in the update by query call, that checks for the existence of the field and sets this field by default.

(system) #3

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