Search on "copy_to"-"keyword" Field and Get/View indexed data of the "copy_to"-"keyword"-Field (not "_source")

Hi together,
is there a possibility to see or view the indexed data stored in an elasticsearch index?

I have a Field which is filled by using "copy_to" of other Fields ("Keyword") and now i have a query that is not finding the results.

To understand what could bee a possible cause i would like to see the stored data.

I have got a simple Example:

DELETE abc_test

PUT abc_test
{
  "mappings": {
    "properties": {
      "test": {
        "properties": {
          "abc": {
            "type": "keyword",
            "copy_to": "combi"
          },
          "xyz": {
            "type": "keyword",
            "copy_to": "combi"
          },
          "combi": {
            "type": "keyword",
            "store" : true
          }
        }
      }
    }
  }
}

POST abc_test/_doc
{
  "test": [
    {
      "abc": "1",
      "xyz": "2"
    },
    {
      "abc": "2",
      "xyz": "3"
    },
    {
      "abc": "4",
      "xyz": "1"
    }
  ]
}

POST abc_test/_doc
{
  "test": [
    {
      "abc": "1",
      "xyz": "6"
    },
    {
      "abc": "7",
      "xyz": "8"
    },
    {
      "abc": "4",
      "xyz": "0"
    }
  ]
}

GET abc_test/_search
{
  "stored_fields": ["test.combi"]
}

GET abc_test/_search
{
  "query": {
    "match_all": {}
  }
}

GET abc_test/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "test.combi": "{what must i search here to finde one stored document?}"
          }
        }
      ]
    }
  }
}

Edit: I've try the store (https://www.elastic.co/guide/en/elasticsearch/reference/7.5/mapping-store.html#mapping-store) but with that i dont see more.

OK, i have got the problem...

It was the mapping.
RIGHT:

"copy_to": "test.combi"

FALSE:

"copy_to": "combi"

Full mapping that works:

PUT abc_test
    {
      "mappings": {
        "properties": {
          "test": {
            "properties": {
              "abc": {
                "type": "keyword",
                "copy_to": "test.combi"
              },
              "xyz": {
                "type": "keyword",
                "copy_to": "test.combi"
              },
              "combi": {
                "type": "keyword",
                "store" : true
              }
            }
          }
        }
      }
    }

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