NOTE: You are looking at documentation for an older release. For the latest information, see the current release documentation.
Multi Match Usage
editMulti Match Usage
editFluent DSL example
editq .MultiMatch(c => c .Fields(f => f.Field(p => p.Description).Field("myOtherField")) .Query("hello world") .Analyzer("standard") .Boost(1.1) .Slop(2) .Fuzziness(Fuzziness.Auto) .PrefixLength(2) .MaxExpansions(2) .Operator(Operator.Or) .MinimumShouldMatch(2) .FuzzyRewrite(MultiTermQueryRewrite.ConstantScoreBoolean) .TieBreaker(1.1) .CutoffFrequency(0.001) .Lenient() .ZeroTermsQuery(ZeroTermsQuery.All) .Name("named_query") )
Object Initializer syntax example
editnew MultiMatchQuery { Fields = Field<Project>(p => p.Description).And("myOtherField"), Query = "hello world", Analyzer = "standard", Boost = 1.1, Slop = 2, Fuzziness = Fuzziness.Auto, PrefixLength = 2, MaxExpansions = 2, Operator = Operator.Or, MinimumShouldMatch = 2, FuzzyRewrite = MultiTermQueryRewrite.ConstantScoreBoolean, TieBreaker = 1.1, CutoffFrequency = 0.001, Lenient = true, ZeroTermsQuery = ZeroTermsQuery.All, Name = "named_query" }
Example json output.
{ "multi_match": { "_name": "named_query", "boost": 1.1, "query": "hello world", "analyzer": "standard", "fuzzy_rewrite": "constant_score_boolean", "fuzziness": "AUTO", "cutoff_frequency": 0.001, "prefix_length": 2, "max_expansions": 2, "slop": 2, "lenient": true, "tie_breaker": 1.1, "minimum_should_match": 2, "operator": "or", "fields": [ "description", "myOtherField" ], "zero_terms_query": "all" } }
Multi match with boost usage
editFluent DSL example
editq .MultiMatch(c => c .Fields(Field<Project>(p => p.Description, 2.2).And("myOtherField^0.3")) .Query("hello world") )
Object Initializer syntax example
editnew MultiMatchQuery { Fields = Field<Project>(p => p.Description, 2.2).And("myOtherField^0.3"), Query = "hello world", }
Example json output.
{ "multi_match": { "query": "hello world", "fields": [ "description^2.2", "myOtherField^0.3" ] } }
Multi match with no fields specified
editStarting with Elasticsearch 6.1.0+, it’s possible to send a Multi Match query without providing any fields.
When no fields are provided the Multi Match query will use the fields defined in the index setting index.query.default_field
(which in turns defaults to *
).
Fluent DSL example
editq .MultiMatch(c => c .Query("hello world") )
Object Initializer syntax example
editnew MultiMatchQuery { Query = "hello world", }
Example json output.
{ "multi_match": { "query": "hello world" } }