Notice
                              
                          
                        
                          
                          
                            Recent Posts
                            
                        
                          
                          
                            Recent Comments
                            
                        
                          
                          
                            Link
                            
                        
                    | 일 | 월 | 화 | 수 | 목 | 금 | 토 | 
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 | 
| 9 | 10 | 11 | 12 | 13 | 14 | 15 | 
| 16 | 17 | 18 | 19 | 20 | 21 | 22 | 
| 23 | 24 | 25 | 26 | 27 | 28 | 29 | 
| 30 | 
                            Tags
                            
                        
                          
                          - PYTHON
 - framework
 - path.data
 - Crontab
 - venv
 - query
 - Data Engineering
 - ELK
 - 7.7.1
 - filebeat
 - grok
 - kibana
 - CSV
 - typescript
 - configure
 - airflow
 - json
 - ubuntu
 - elasticsearch
 - KoA
 - elastic
 - Tutorial
 - node.js
 - dense_vector
 - logstash
 - DSL
 - windows
 - devtools
 - OPCUA
 - package.json
 
                            Archives
                            
                        
                          
                          - Today
 
- Total
 
Gibbs Kim's playground
[ElasticStack-7] Dense Vector in Elasticsearch 본문
Elasticsearch에서는 vector 값을 직접 입력할 수 있다. dense_vector로 불리는 이 필드는 float 타입의 데이터를 저장 가능하다. (A dense_vector field stores dense vectors of float values.)
필드는 차원 값을 가지는데 2048을 초과할 수 없다. (The maximum number of dimensions that can be in a vector should not exceed 2048. A dense_vector field is a single-valued field.)
Example in Dev tools
## Create index and mapping
PUT dense_vector_test_index
{
	"mappings": {
    	"properties": {
        	"my_dense_vector": {
            	"type" : "dense_vector",
                "dims" : 100
            },
            "my_test_text" : {
            	"type" : "keyword"
            }
        }
    }
}
## Input example vector value
PUT dense_vector_test_index/_doc/3
{	## All data in Elasticsearch, type is doc. 3 is temporary ID in doc.
	"my_test_text" : "corporation",
    "my_dense_vector" : [ 0.30044875, -08096953, 0.03830861, 0.02427242, 0.05239175,
    			0.11283469, 0.01669317, 0.07109312, -0.10938835, -0.17000835,
                0.16206388, 0.18072662, -0.11470463, 0.01919608, -0.04658141,
                0.05263321, 0.09595548, 0.02676269, 0.01009388, -0.6520367,
                ...,
                ...,
                ...,
                ] # You can insert values 100 counts.    
}
### Result example
{
...
{
	"_index" : "dense_vector_test_index",
    "_type" : "_doc",
    "_id" : "1",
    "_score" : 1.0,
    "_source" : {
    	"my_test_text" : "plot",
        "my_dense_vector" : " { ... }
    }
}
...
}
참고 Link
Dense vector datatype | Elasticsearch Reference [7.6] | Elastic
Dense vector datatypeedit A dense_vector field stores dense vectors of float values. The maximum number of dimensions that can be in a vector should not exceed 2048. A dense_vector field is a single-valued field. These vectors can be used for document scor
www.elastic.co
'Tech 기록지 > Elastic Stack' 카테고리의 다른 글
| [ElasticStack-9] CSV file 한글 내용 logstash 업로드 (convert utf-8 encoding) (0) | 2020.06.03 | 
|---|---|
| [ElasticStack-8] Elasticsearch indexing json through Logstash (0) | 2020.05.29 | 
| [ElasticStack-6] 정규표현식(regex)과 Logstash (0) | 2020.04.23 | 
| [ElasticStack-5] .csv file insert to Elasticsearch via Logstash.conf (0) | 2020.04.06 | 
| [ElasticStack-4] Windows PowerShell execution policy (feat. Filebeat) (0) | 2020.04.06 |