How can i check if the value of the field is an array?

Hi everyone,

By accident i inserted some values as arrays inside the index, when the actual value should have been a string.

This is the wrong value :

{
"hits" : [
      {
        "_index" : "en_file",
        "_type" : "_doc",
        "_id" : "I5nOLnkB0v90hg-Gubwb",
        "_score" : 10.830619,
        "_source" : {
          "url" : [
            "https://repository.dri.ie/objects/ws85q0866/files/x059rs54j?surrogate=pdf"
          ]
   }
}

When it should have been:

{
"hits" : [
      {
        "_index" : "en_file",
        "_type" : "_doc",
        "_id" : "I5nOLnkB0v90hg-Gubwb",
        "_score" : 10.830619,
        "_source" : {
          "url" :  "https://repository.dri.ie/objects/ws85q0866/files/x059rs54j?surrogate=pdf"
   }
}

Any ideas how can i query values that are arrays and not as normal string?

Kibana should query an array in similar manner, for example:

{
  "_index": "kibana_sample_data_ecommerce",
  "_id": "8gWDJnwBCYOiYwe6faLd",
  "_version": 1,
  "_score": 1,
  "_source": {
    "category": [
      "Men's Clothing",
      "Men's Accessories"
    ],

And KQL query in discover like category.keyword : "Men's Accessories" will match this document

And es docs on querying and array type: Arrays | Elasticsearch Guide [7.15] | Elastic

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