Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9243339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:47:25+00:00 2026-06-18T08:47:25+00:00

I’m working with ElasticSearch. When I do this query: {query: blackberry -q10} I get

  • 0

I’m working with ElasticSearch.
When I do this query:

{query: "blackberry -q10"}

I get exactly what I want (all results which have reference to BlackBerry but not Q10).

However, I want to restrict the fields which are searched to just the “title” field. Eg, the _source documents have titles, body, tags, etc. and I only want to search the title. The ElasticSearch “Match” seems right for me…

{query: {match: {title: "blackberry -q10"}}}

While this succeeds in only searching the title, it still returns results with have Q10 in the title, unlike the search above.

I’m looking at the match documentation but can’t seem to figure it out.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:47:26+00:00Added an answer on June 18, 2026 at 8:47 am

    The Match query doesn’t use negation syntax like that. E.g you can’t use a “minus” to negate a term. It will be parsed as a hyphen by the default search analyzer.

    I would use a filtered query in this case. You could add the negation in a query…but a filter will be much faster.

    {
      "filtered":{
         "query":{
            "match":{
               "title":"blackberry"
            }
         },
         "filter":{
            "bool":{
               "must_not":{
                   "term":{
                      "title":"q10"
                  }
               }
            }
         }
      }
    }
    

    Note, you may need to change the term filter, depending on how you analyzed the field at index time.

    EDIT:
    Based on your comment below, if you really want to keep the ability to do negations “inline”, you would use the field query (a more specific version of query_string, which would also work). This query uses Lucene syntax, which allows inline negation

    {
       "field" : {
           "title" : "blackberry -q10"
       }
    }
    

    The reason query_string and it’s derivatives are not recommended is because it is easy to shoot yourself in the foot. Or rather, it’s easy for your users to shoot your server in the face. Query_string demands proper syntax and will simply die if the users enter it incorrectly. It also allows your users to make some horrible inefficient queries, usually through wildcards

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a text area in my form which accepts all possible characters from
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have an autohotkey script which looks up a word in a bilingual dictionary
This could be a duplicate question, but I have no idea what search terms
I have an array which has BIG numbers and small numbers in it. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.