-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
When using a variable as a suffix, it doesn't return the JSON you would expect.
For example, this code snippit
var dynamicFields = new List<string> { "private-email", "birthday", "fax" };
...
.Query(searchQuery)
.Type(TextQueryType.CrossFields)
.OnFieldsWithBoost(fb =>
{
fb
.Add(f => f.FirstName, 3.0)
.Add(f => f.FirstName.Suffix("edge_ngram"), 2.0)
.Add(f => f.LastName, 3.0)
.Add(f => f.LastName.Suffix("edge_ngram"), 2.0)
.Add(f => f.EmailAddress, 3.0)
.Add(f => f.EmailAddress.Suffix("edge_ngram"), 2.0)
.Add(f => f.Country.Name, 3.0)
.Add(f => f.Country.Name.Suffix("edge_ngram"), 2.0)
.Add(f => f.Country.ISO2, 1.0);
foreach (string suffix in dynamicFields)
{
fb.Add(f => f.DynamicFields.Suffix(suffix), 3.0);
}
}
)
...
results in the following JSON (notice the dynamicFields):
...
{
"type": "cross_fields",
"query": "demo",
"fields": [
"firstName^3",
"firstName.edge_ngram^2",
"lastName^3",
"lastName.edge_ngram^2",
"emailAddress^3",
"emailAddress.edge_ngram^2",
"country.name^3",
"country.name.edge_ngram^2",
"country.iSO2^1",
"suffix.dynamicFields^3",
"suffix.dynamicFields^3",
"suffix.dynamicFields^3"
]
}
...
Metadata
Metadata
Assignees
Labels
No labels