elasticsearch-sql icon indicating copy to clipboard operation
elasticsearch-sql copied to clipboard

不能支持copy_to的字段检索吗

Open leviYX opened this issue 2 years ago • 1 comments

leviYX avatar Feb 03 '23 06:02 leviYX

可以

curl -X PUT "localhost:9200/my-index-000001?pretty" -H 'Content-Type: application/json' -d'
{
  "mappings": {
    "properties": {
      "first_name": {
        "type": "text",
        "copy_to": "full_name" 
      },
      "last_name": {
        "type": "text",
        "copy_to": "full_name" 
      },
      "full_name": {
        "type": "text"
      }
    }
  }
}
'
curl -X PUT "localhost:9200/my-index-000001/_doc/1?pretty" -H 'Content-Type: application/json' -d'
{
  "first_name": "John",
  "last_name": "Smith"
}
'
SELECT * FROM my-index-000001 where full_name=match_query('John Smith')

shi-yuan avatar Feb 07 '23 15:02 shi-yuan