Elasticsearch - return records having a field falling in the given range

Here is your mapping:

{
  "arxivdb": {
    "mappings": {
      "_doc": {
        "properties": {
          "0": {
            "properties": {
              // Skipped for clarity
              "created": {
                "type": "long"
              },
              // Skipped for clarity
            }
          },
          "1": {
            "properties": {
              // Skipped for clarity
              "created": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              },
              // Skipped for clarity
            }
          },
          "3": {
            "properties": {
              // Skipped for clarity
              "created": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              },
              // Skipped for clarity
            }
          },
          "4": {
            "properties": {
              // Skipped for clarity
              "created": {
                "type": "long"
              },
              // Skipped for clarity
            }
          },
          "5": {
            "properties": {
              // Skipped for clarity
              "created": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              },
              // Skipped for clarity
            }
          },
          // Skipped for clarity
          "created": {
            "type": "date",
            "format": "yyyy-MM-dd'T'HH:mm:ss"
          },
          // Skipped for clarity
        }
      }
    }
  }
}

It's definitely a mess. Multiple created fields, at different levels.

              "created": {
                "type": "long"
              },
              "created": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              },
          "created": {
            "type": "date",
            "format": "yyyy-MM-dd'T'HH:mm:ss"
          },

You probably need to start again from scratch.

If you have further questions please provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are exactly doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

1 Like