|
@@ -95,7 +95,9 @@ The actions to take when the rule matches a query:
|
|
|
* `ids` will pin the specified <<mapping-id-field,`_id`>>s.
|
|
|
* `docs` will pin the specified documents in the specified indices.
|
|
|
|
|
|
-Use `ids` when searching over a single index, and `docs` when searching over multiple indices. See <<query-dsl-pinned-query,pinned query>> for details.
|
|
|
+Use `ids` when searching over a single index, and `docs` when searching over multiple indices.
|
|
|
+`ids` and `docs` cannot be combined in the same query.
|
|
|
+See <<query-dsl-pinned-query,pinned query>> for details.
|
|
|
|
|
|
[discrete]
|
|
|
[[add-query-rules]]
|
|
@@ -105,8 +107,8 @@ You can add query rules using the <<put-query-ruleset>> call. This adds a rulese
|
|
|
|
|
|
The following command will create a query ruleset called `my-ruleset` with two pinned document rules:
|
|
|
|
|
|
-* The first rule will generate a <<query-dsl-pinned-query>> pinning the <<mapping-id-field,`_id`>>s `id1` and `id2` when the `user.query` metadata value is a fuzzy match to either `puggles` or `pugs` _and_ the user's location is in the US.
|
|
|
-* The second rule will generate a <<query-dsl-pinned-query>> pinning the <<mapping-id-field, `_id`>> of `id3` specifically from the `my-index-000001` index and `id4` from the `my-index-000002` index when the `user.query` metadata value matches `beagles`.
|
|
|
+* The first rule will generate a <<query-dsl-pinned-query>> pinning the <<mapping-id-field,`_id`>>s `id1` and `id2` when the `query_string` metadata value is a fuzzy match to either `puggles` or `pugs` _and_ the user's location is in the US.
|
|
|
+* The second rule will generate a <<query-dsl-pinned-query>> pinning the <<mapping-id-field, `_id`>> of `id3` specifically from the `my-index-000001` index and `id4` from the `my-index-000002` index when the `query_string` metadata value contains `beagles`.
|
|
|
|
|
|
////
|
|
|
[source,console]
|
|
@@ -132,7 +134,7 @@ PUT /_query_rules/my-ruleset
|
|
|
},
|
|
|
{
|
|
|
"type": "exact",
|
|
|
- "metadata": "user.country",
|
|
|
+ "metadata": "user_country",
|
|
|
"values": [ "us" ]
|
|
|
}
|
|
|
],
|
|
@@ -204,7 +206,7 @@ GET /my-index-000001/_search
|
|
|
},
|
|
|
"match_criteria": {
|
|
|
"query_string": "puggles",
|
|
|
- "user.country": "us"
|
|
|
+ "user_country": "us"
|
|
|
},
|
|
|
"ruleset_id": "my-ruleset"
|
|
|
}
|
|
@@ -214,4 +216,4 @@ GET /my-index-000001/_search
|
|
|
// TEST[continued]
|
|
|
|
|
|
This rule query will match against `rule1` in the defined query ruleset, and will convert the organic query into a pinned query with `id1` and `id2` pinned as the top hits.
|
|
|
-Any other matches from the `user.query` query specified in the organic query will be returned below the pinned results.
|
|
|
+Any other matches from the organic query will be returned below the pinned results.
|