Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to change elasticsearch type keyword to array?

POST /jobs/_doc/1/
{
  "test": [["A", "B"], ["C", "A"]]
}
GET /jobs/_search/
{
  "_source": false,
  "query": {
    "script_score": {
      "query": {
        "match_all": {}
      },
      "script": {
        "source": """
          Debug.explain(doc['test.keyword']);
          return 1;
        """
      }
    }
  }
}

kibana print to string is "[A, B, C]", how can i get like [["A", "B"], ["B", "C"]] in painless script?

i try to change mapping but it cant work always.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Tldr;

You can’t via indexed fields.
BUT it is possible is you access the source

Solution

GET 74557564/_search
{
  "_source": false,
  "query": {
    "script_score": {
      "query": {
        "match_all": {}
      }, 
      "script": {
        "source": """
          Debug.explain(params._source['data']);
          return 1;
        """
      }
    }
  }
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading