Query range lte return all data

Hi everybody,

I encountered a problem with a "range" request with the "lte" operator alone.
With only "lte" in the query, this returns all the data. With "gte" or "gte" / "lte", the result is the one expected.

We declared the field as data type "float". See the query below.

Is this problem known?

Here the mapping:

{
  "mapping": {
    "document": {
      "properties": {
        "container": {
          "properties": {
            "id": {
              "type": "integer"
            }
          }
        },
        "fast_search": {
          "type": "text",
          "analyzer": "analyzer_special_characters"
        },
        "form_document_containers": {
          "properties": {
            "form_instances": {
              "properties": {
                "form_field_data": {
                  "properties": {
                    "field_data_number": {
                      "type": "double",
                      "copy_to": [
                        "fast_search"
                      ]
                    },
                    "field_data_string": {
                      "type": "text",
                      "copy_to": [
                        "fast_search"
                      ]
                    },
                    "id": {
                      "type": "integer"
                    }
                  }
                },
                "id": {
                  "type": "integer"
                }
              }
            },
            "id": {
              "type": "integer"
            }
          }
        },
        "id": {
          "type": "integer"
        }
      }
    }
  }
}

Here the query:

GET dev_jguyenot_apiplatform/_search
{
    "query": {
      "bool": {
        "should": [
          {
            "bool": {
              "must": [
                {
                  "match": {
                    "form_document_containers.form_instances.form_model.id": "2"
                  }
                },
                {
                  "bool": {
                    "must": [
                      {
                        "match": {
                          "form_document_containers.form_instances.form_field_data.form_field.uniq_name": "TOTALTTC"
                        }
                      },
                      {
                        "range": {
                          "form_document_containers.form_instances.form_field_data.field_data_number": {
                            "lte": "100.00"
                          }
                        }
                      }
                    ]
                  }
                }
              ]
            }
          }
        ]
      }
    }
}

We also try to change "double" to "float" but no changes.

Up please.

you may want to replace the should part of the most outer bool query with a must.

What was the reason for picking should here in the first place? Maybe I am misunderstanding your intention here.

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