elastic/elasticsearch-net-example

Reference to obsolete method 'OnFieldsWithBoost' in 5.x documentation

Closed this issue · 2 comments

The README.md documents on branches 5.x, 5.x-codecomplete and 5.x-deploy include code references to OnFieldsWithBoost, which has been removed and is not available in the 5.x API.

The correct sample code under Conditionless Queries should be

.Query(q =>
	q.Match(m=>m.Field(p=>p.Id.Suffix("keyword")).Boost(1000).Query(form.Query))
	|| q.FunctionScore(fs => fs
		.Functions(ff => ff
			.FieldValueFactor(fvf => fvf
				.Field(p => p.DownloadCount)
				.Factor(0.0001)
			)
		)
		.Query(query => query
			.MultiMatch(m => m
				.Fields(f => f
				      .Field(p => p.Id, 1.2)
				      .Field(p => p.Summary, 0.8)
                                )
				.Operator(Operator.And)
				.Query(form.Query)
			)
		)
	)
)

I'm happy to fix this (and anything else I find) and submit PRs, but wanted to check that this would be helpful / desired before I do so.

Thank you @christofur, this is super helpful! Would love PRs for this ❤️

fixed as per #15 courtesy of @christofur