How to group or merge multiple fields to one field name

hi,
I have a problem, I have several fields with similar names, for example: rest.direction, mmu.direction, xml.direction, and I need them to be displayed in Kiban only under one field, for example "direction". Is it possible to do it?? what I read, the alias is only for one field.

Welcome!

Have a look at field aliases.

Thanks for the answer, but I don't know if alias is the right solution. I guess I can't set it up, I called it like this and the source for the alias always changes, a new one is not added.

PUT index_name/_mapping
{
  "properties": {
    "direction": {
      "type": "alias",
      "path": "rest.direction" 
    }
  }
}
 
PUT index_name/_mapping
{
  "properties": {
    "direction": {
      "type": "alias",
      "path": "xml.direction" 
    }
  }
} 

Not sure I understand what you're saying. A complete example would help.

But anyway, the other option could be runtime fields.

I need make

So field alias should work.
Runtime fields as well. But I prefer the former in that case.

I don know writt this alliases for one name "direction" for more source fields. my source path is always overwritten Plese send me example.

DELETE /test1,test2
PUT /test1
{
  "mappings": {
    "properties": {
      "xml.direction": {
        "type": "text"
      },
      "direction": {
        "type": "alias",
        "path": "xml.direction" 
      }
    }
  }
}
PUT /test2
{
  "mappings": {
    "properties": {
      "rest.direction": {
        "type": "text"
      },
      "direction": {
        "type": "alias",
        "path": "rest.direction" 
      }
    }
  }
}

POST /test1/_doc
{
  "xml.direction": "foo"
}
POST /test2/_doc
{
  "rest.direction": "bar"
}

GET /test1,test2/_search
{
  "query": {
    "match": {
      "direction": "foo bar"
    }
  }
}

Then in Kibana:

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