-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Closed
Copy link
Description
NEST/ElasticSearch.Net 5.3
Elasticsearch 5.5
When running a collate query on a phrase suggester the json produced and sent to the server looks like this with the params object inside of the query object:
"collate": {
"query": {
"inline": "{\"bool\":{\"must\":[{\"match\":{\"{{field-name}}\":{\"query\":\"{{suggestion}}\",\"type\":\"phrase\"}}}],\"filter\":[{\"nested\":{\"query\":{\"bool\":{\"filter\":[{\"term\":{\"listings.site-ids\":{\"value\":\"{{site-id}}\"}}},{\"term\":{\"listings.region-id\":{\"value\":\"{{region-id}}\"}}},{\"term\":{\"listings.industry-id\":{\"value\":\"{{industry-id}}\"}}}]}},\"path\":\"listings\"}},{\"bool\":{\"must_not\":[{\"exists\":{\"field\":\"private-ids\"}}]}}]}}}",
"params": {
"field-name": "name",
"site-id": "1",
"region-id": "1",
"industry-id": "4"
}
},
"prune": true
}
While a working query when setting up the json manually looks like this with the params object inside of the collate object instead:
"collate": {
"query": {
"inline": "{\"bool\":{\"must\":[{\"match\":{\"{{field-name}}\":{\"query\":\"{{suggestion}}\",\"type\":\"phrase\"}}}],\"filter\":[{\"nested\":{\"query\":{\"bool\":{\"filter\":[{\"term\":{\"listings.site-ids\":{\"value\":\"{{site-id}}\"}}},{\"term\":{\"listings.region-id\":{\"value\":\"{{region-id}}\"}}},{\"term\":{\"listings.industry-id\":{\"value\":\"{{industry-id}}\"}}}]}},\"path\":\"listings\"}},{\"bool\":{\"must_not\":[{\"exists\":{\"field\":\"private-ids\"}}]}}]}}"
},
"params": {
"field-name": "name",
"site-id": "1",
"region-id": "1",
"industry-id": "4"
},
"prune": true
}
Steps to reproduce:
- Setup a phrase suggester in json with a collate query that takes parameters
- Setup the same phrase suggester in .Net
- Compare the request body of the .Net request to the json from Step 1 and see the params object is at the wrong level so in the .Net request the params are not replaced in the collate query
Adding a Params property to PhraseSuggestCollate fixes this and produces a working request.
Metadata
Metadata
Assignees
Labels
No labels