mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-09 22:45:04 +00:00
b118558962
Previously, the only way to specify a document not present in the index was to use `like_text`. This would usually lead to complex queries made of multiple MLT queries per document field. This commit adds the ability to the MLT query to directly specify documents not present in the index (artificial documents). The syntax is similar to the Percolator API or to the Multi Term Vector API. Closes #7725
55 lines
1.1 KiB
YAML
55 lines
1.1 KiB
YAML
---
|
|
"Basic mlt query with docs":
|
|
- do:
|
|
index:
|
|
index: test_1
|
|
type: test
|
|
id: 1
|
|
body: { foo: bar }
|
|
|
|
- do:
|
|
index:
|
|
index: test_1
|
|
type: test
|
|
id: 2
|
|
body: { foo: baz }
|
|
|
|
- do:
|
|
index:
|
|
index: test_1
|
|
type: test
|
|
id: 3
|
|
body: { foo: foo }
|
|
|
|
- do:
|
|
indices.refresh: {}
|
|
|
|
- do:
|
|
cluster.health:
|
|
wait_for_status: green
|
|
|
|
- do:
|
|
search:
|
|
index: test_1
|
|
type: test
|
|
body:
|
|
query:
|
|
more_like_this:
|
|
docs:
|
|
-
|
|
_index: test_1
|
|
_type: test
|
|
doc:
|
|
foo: bar
|
|
-
|
|
_index: test_1
|
|
_type: test
|
|
_id: 2
|
|
ids:
|
|
- 3
|
|
include: true
|
|
min_doc_freq: 0
|
|
min_term_freq: 0
|
|
|
|
- match: { hits.total: 3 }
|