일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Test
- API
- License
- flask
- 차트
- springboot
- high level client
- Elasticsearch
- query
- 파이썬
- TensorFlow
- aggregation
- Mac
- 900gle
- license delete
- plugin
- zip 암호화
- docker
- Kafka
- matplotlib
- MySQL
- Java
- zip 파일 암호화
- licence delete curl
- Python
- token filter test
- aggs
- analyzer test
- ELASTIC
- sort
Archives
- Today
- Total
개발잡부
[es] 검색쿼리를 만들어 보자 2 본문
반응형
https://www.elastic.co/guide/en/elasticsearch/reference/current/similarity.html
similarity | Elasticsearch Guide [7.16] | Elastic
Elasticsearch allows you to configure a scoring algorithm or similarity per field. The similarity setting provides a simple way of choosing a similarity algorithm other than the default BM25, such as TF/IDF. Similarities are mostly useful for text fields,
www.elastic.co
이건 또 뭐꼬..
할게 너무 많네
PUT /index?pretty
{
"settings": {
"number_of_shards": 1,
"similarity": {
"scripted_tfidf": {
"type": "scripted",
"script": {
"source": "double tf = Math.sqrt(doc.freq); double idf = Math.log((field.docCount+1.0)/(term.docFreq+1.0)) + 1.0; double norm = 1/Math.sqrt(doc.length); return query.boost * tf * idf * norm;"
}
}
}
},
"mappings": {
"properties": {
"field": {
"type": "text",
"similarity": "scripted_tfidf"
}
}
}
}
PUT /index/_doc/1?pretty
{
"field": "foo bar foo"
}
PUT /index/_doc/2?pretty
{
"field": "bar baz"
}
POST /index/_refresh?pretty
GET /index/_search?explain=true&pretty
{
"query": {
"query_string": {
"query": "foo^1.7",
"default_field": "field"
}
}
}
반응형
'ElasticStack > Elasticsearch' 카테고리의 다른 글
[es] 쿼리를 확인해보자 (0) | 2022.01.30 |
---|---|
[es] 검색쿼리를 만들어 보자 3 (0) | 2022.01.30 |
[es] 검색결과 비교 - score (0) | 2022.01.28 |
[es] 검색결과를 검증해보자 (0) | 2022.01.21 |
[es] 검색쿼리에 랭킹을 적용해보자! (0) | 2022.01.20 |
Comments