0

I would like to create a new query or modify this one:

curl -XGET 'http://localhost:9200/my_index/_search?/pretty=true' -d ' 
{
  "fields" : ["city", "element_name", "organization"],
  "query" : {
    "bool" : {
      "must" : [
    {
          "match" : { "organization" : "MyOrganizationName" }
        },        
    { 
          "query_string" : {
            "query" : "Input",
            "fields" : [ "element_name", "city"]
          }
        }
      ]
    }
  },
  "filter" : {
    "type" : {"value" : "Project"}
  }
}'

To the point, where it can search mongodb with these criteria:

  • Input: "tring" -> finds "String" or "Longer String"
  • Input: "Longer" or "String" -> finds "Longer String"

I haven't changed query_string to match, because I substitute desired functionality with *.

I was also wondering, whether analyzer might come handy, however I have no idea how to set it up. How can I do this?

hichris123
  • 10,145
  • 15
  • 56
  • 70
Miso
  • 1
  • I am not quite sure what exactly you are asking. But if you are looking for faster substring searches, please take a look at this answer http://stackoverflow.com/a/6471449/783043 – imotov Jul 22 '13 at 16:32
  • Thanks for the link, I have managed to set up mappings and analyzers that do what I wanted, however, if I understand correctly, you have to run analyzer settings each time you index collection, is there any way to put the desired settings into search query? – Miso Jul 23 '13 at 16:40

0 Answers0