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 8444775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:29:05+00:00 2026-06-10T09:29:05+00:00

let’s say that in my elasticsearch index I have a field called dots which

  • 0

let’s say that in my elasticsearch index I have a field called “dots” which will contain a string of punctuation separated words (e.g. “first.second.third”).

I need to search for e.g. “first.second” and then get all entries whose “dots” field contains a string being exactly “first.second” or starting with “first.second.”.

I have a problem understanding how the text querying works, at least I have not been able to create a query which does the job.

  • 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-10T09:29:07+00:00Added an answer on June 10, 2026 at 9:29 am

    Elasticsearch has Path Hierarchy Tokenizer that was created exactly for such use case. Here is an example of how to set it for your index:

    # Create a new index with custom path_hierarchy analyzer 
    # See http://www.elasticsearch.org/guide/reference/index-modules/analysis/pathhierarchy-tokenizer.html
    curl -XPUT "localhost:9200/prefix-test" -d '{
        "settings": {
            "analysis": {
                "analyzer": {
                    "prefix-test-analyzer": {
                        "type": "custom",
                        "tokenizer": "prefix-test-tokenizer"
                    }
                },
                "tokenizer": {
                    "prefix-test-tokenizer": {
                        "type": "path_hierarchy",
                        "delimiter": "."
                    }
                }
            }
        },
        "mappings": {
            "doc": {
                "properties": {
                    "dots": {
                        "type": "string",
                        "analyzer": "prefix-test-analyzer",
                        //"index_analyzer": "prefix-test-analyzer", //deprecated
                        "search_analyzer": "keyword"
                    }
                }
            }
        }
    }'
    echo
    # Put some test data
    curl -XPUT "localhost:9200/prefix-test/doc/1" -d '{"dots": "first.second.third"}'
    curl -XPUT "localhost:9200/prefix-test/doc/2" -d '{"dots": "first.second.foo-bar"}'
    curl -XPUT "localhost:9200/prefix-test/doc/3" -d '{"dots": "first.baz.something"}'
    curl -XPOST "localhost:9200/prefix-test/_refresh"
    echo
    # Test searches. 
    curl -XPOST "localhost:9200/prefix-test/doc/_search?pretty=true" -d '{
        "query": {
            "term": {
                "dots": "first"
            }
        }
    }'
    echo
    curl -XPOST "localhost:9200/prefix-test/doc/_search?pretty=true" -d '{
        "query": {
            "term": {
                "dots": "first.second"
            }
        }
    }'
    echo
    curl -XPOST "localhost:9200/prefix-test/doc/_search?pretty=true" -d '{
        "query": {
            "term": {
                "dots": "first.second.foo-bar"
            }
        }
    }'
    echo
    curl -XPOST "localhost:9200/prefix-test/doc/_search?pretty=true&q=dots:first.second"
    echo
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have an abstract parent class called shape, and that there are
Let's say I'm creating an OpenGL game in C++ that will have many objects
Let's say I have a method in java, which looks up a user in
Let me explain best with an example. Say you have node class that can
Let's say that I have a SQLite database that I create in a separate
Let's say I have a string like this: var str = /abcd/efgh/ijkl/xxx-1/xxx-2; How do
Let's say I have two text files that I need to extract data out
Let's say I have some text as follows: do this, do that, then this,
let's say I have the following string: string s = A B C D
Let's say I have a main folder in my website named test which contains

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.