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

  • Home
  • SEARCH
  • 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 8258565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:35:02+00:00 2026-06-08T02:35:02+00:00

I have the following Elastic Search query with only a term filter. My query

  • 0

I have the following Elastic Search query with only a term filter. My query is much more complex but I am just trying to show the issue here.

{
    "filter": {
            "term": {
                    "field": "update-time"
                }
        }
}

When I pass in a hyphenated value to the filter, I get zero results back. But if I try without an unhyphenated value I get results back. I am not sure if the hyphen is an issue here but my scenario makes me believe so.

Is there a way to escape the hyphen so the filter would return results? I have tried escaping the hyphen with a back slash which I read from the Lucene forums but that didn’t help.

Also, if I pass in a GUID value into this field which is hyphenated and surrounded by curly braces, something like – {ASD23-34SD-DFE1-42FWW}, would I need to lower case the alphabet characters and would I need to escape the curly braces too?

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-08T02:35:04+00:00Added an answer on June 8, 2026 at 2:35 am

    I would guess that your field is analyzed, which is default setting for string fields in elasticsearch. As a result, when it indexed it’s not indexed as one term “update-time” but instead as 2 terms: “update” and “time”. That’s why your term search cannot find this term. If your field will always contain values that will have to be matched completely as is, it would be the best to define such field in mapping as not analyzed. You can do it by recreating the index with new mapping:

    curl -XPUT http://localhost:9200/your-index -d '{
        "mappings" : {
            "your-type" : {
                "properties" : {
                    "field" : { "type": "string", "index" : "not_analyzed" }
                }
            }
        }
    }'
    
    curl -XPUT  http://localhost:9200/your-index/your-type/1 -d '{
        "field" : "update-time"
    }'
    
    curl -XPOST http://localhost:9200/your-index/your-type/_search -d'{
        "filter": {
            "term": {
                    "field": "update-time"
            }
        }
    }'
    

    Alternatively, if you want some flexibility in finding records based on this field, you can keep this field analyzed and use text queries instead:

    curl -XPOST http://localhost:9200/your-index/your-type/_search -d'{
        "query": {
            "text": {
                    "field": "update-time"
            }
        }
    }'
    

    Please, keep in mind that if your field is analyzed then this record will be found by searching for just word “update” or word “time” as well.

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

Sidebar

Related Questions

I have the following mapping for a Elastic Search index. I am posting (PUT)
I have a site running on amazon elastic beanstalk with the following traffic pattern:
Have following strange issue, have 7 lines (same classes) but after 2 lines it's
I have following code that creates Linq query. I've never used Linq until today
I am trying to use elastic search module in the play framework for searching
I have following code. It works fine in firefox but is not working in
Have following String built SQL query: StringBuilder querySelect = new StringBuilder(select * from messages
I have following plist: <?xml version=1.0 encoding=UTF-8?> <!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd>
I have following source. In insertMessage(..), it calls selectMessage to check whether duplicate record
I have following div in a page (I can not modify). <div id=:0.control>Click me</div>

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.