question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multi match creates invalid query

See original GitHub issue

This example:

bodybuilder()
        .query('multi_match', [ "info.name^3", "info.main_url^2" ], 'this is a test')
		.filter('term', 'user', 'kimchy')
        .build()

creates this query json:

{
  "query": {
    "bool": {
      "filter": {
        "term": {
          "user": "kimchy"
        }
      },
      "must": {
        "multi_match": {
          "info.name^3,info.main_url^2": "this is a test"
        }
      }
    }
  }
}

which is invalid query (tested with ES validate method ). I think problem is that multi_match expect ‘fields’ and ‘query’ argument and here it just creates query that is similar to normal match query.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

3reactions
johannes-scharlachcommented, May 28, 2017

The idea with bodybuilder v2 is that for complex queries like multi_match or query_string, you only specify an options object, like this:

bodybuilder()
  .query(
    'multi_match',
    {
      query: 'hello',
      fuzziness: 5,
      prefix_length: 0,
      fields: ['Field1^1000', 'Field2^3', 'Field3^2', 'Field4']
    }
  )
  .build()
2reactions
rossvzcommented, Oct 16, 2017

Just ran into this - would be great to have this documented in the docs somewhere!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Elastic Search multi match gets wrong result - Stack Overflow
The result from the Elastic using this query is a segment which includes "first_name" field "tony" and "last_name" field "lopez", but also a ......
Read more >
Invalid Results with whitespace analyzer and Multi match search
We tried PUTTING custom analyzer and then re indexed all our indices. Now it works without specifying the analyzer while querying. But is...
Read more >
Filter and pattern syntax - Amazon CloudWatch Logs
You can use pattern matching to create filter patterns that return log events containing single and multiple terms. Place a question mark ("?...
Read more >
Multi-Match Detailed Results – Thursday, December 1, 2022
If you have a winning ticket, click here to schedule an appointment. Multi-Match Detailed Results. Thursday, December 1, 2022. 19-27-31- ...
Read more >
Error messages | BigQuery - Google Cloud
Error table · Try breaking up the query into smaller pieces. · Try removing an ORDER BY clause. · If your query uses...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found