Error from ES Querystring query when fields are mentioned

Hi ,
I have below query which is working fine when I don't specify fields , but when I want to search on few fields then I am getting something like All Shards failed...can you please resolve my issue..
Below is my query...
```
CODE

{  
   "explain":true,
   "query":{  
      "bool":{  
         "must":[  
            {  
               "query_string":{  
                  "fields":[  
                     "Additional_Instruction.keyword",
                     "CompletedDate",
                     "Current_Packaging_Code.keyword",
                     "Dimensions.keyword",
                     "Do_you_want_to_Notify_Printer.keyword",
                     "DocketNo",
                     "DueDate",
                     "EstimatedCompletionDate",
                     "ForecastEndDate",
                     "TEST_Artwork_Studio.keyword",
                     "TEST_Comments.keyword",
                     "TEST_Component_Name.keyword",
                     "TEST_Component_Type.keyword",
                     "TEST_Country.keyword",
                     "TEST_Description.keyword",
                     "TEST_Pack_Size.keyword",
                     "TEST_Packaging_Site.keyword",
                     "TEST_Product_Name.keyword",
                     "TEST_Project_Name.keyword",
                     "TEST_Strength.keyword",
                     "HoldDays",
                     "ID",
                     "IsDefunct",
                     "IsJobArchived",
                     "IsJobCanceled",
                     "IsJobOnHold",
                     "IsJobPhasedOut",
                     "ItemID",
                     "ItemName.keyword",
                     "ItemType.keyword",
                     "ItemTypeID",
                     "JobDueDate",
                     "JobEstimatedDate",
                     "JobGroups.keyword",
                     "JobInitiator.keyword",
                     "JobLastUpdated",
                     "JobLastUpdatedBy.keyword",
                     "JobOwner.keyword",
                     "JobOwnerGroup.keyword",
                     "JobStartDate",
                     "JobStatus",
                     "JobType",
                     "JobVariance.keyword",
                     "Keyline_Number.keyword",
                     "LastUpdate",
                     "LinkedParentJobs",
                     "Old_Packaging_Code.keyword",
                     "OriginalEndDate",
                     "ParentID",
                     "PartNumber.keyword",
                     "PassCycle.keyword",
                     "Pharma_Code.keyword",
                     "Prefix.keyword",
                     "Printers.keyword",
                     "ProofCycle.keyword",
                     "RelationID",
                     "Required_By_Date.keyword",
                     "RevisionNumber",
                     "RoutingTemplateName.keyword",
                     "StageID",
                     "StageName.keyword",
                     "StartDate",
                     "StatusID",
                     "TotalPassCount.keyword",
                     "Version",
                     "WorkflowID",
                     "WorkflowName.keyword",
                     "brCode.keyword",
                     "chkinterworkflow.keyword",
                     "jobtrackstatus.keyword"
                  ],
                  "query":"18-01*"
               }
            }
         ],
         "_name":"TESTquery"
      }
   },
   "size":10000,
   "sort":[  
      {  
         "_score":{  
            "order":"desc"
         }
      }
   ],
   "track_scores":true
}

CODE

Please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

This is the icon to use if you are not using markdown format:

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.
Please update your post.

Could you share the error log and/or the response from elasticsearch?

Thanks @dadoonet I am new to this forum, will surely follow the guidelines from now on :slight_smile:
Coming to the problem , What I understood is when I mention 1 or 2 fields in fields array I am recieving response. but when I mention huge set of fields(I dont find exclude fields option either because my exclude list is very less) I am getting error.
I believe this could be due to lenght of query ...can you please help me to come out of this.

Please read the instructions I gave. This is not formatted as you can see.

This:

{
"_score":{
"order":"desc"
}
}

is different from:

{
  "_score":{
    "order":"desc"
  }
}

Please adjust your code.

And please answer my question:

Hi @dadoonet , from the error logs I found that the fields mentioned are of different types like long,boolean and date but I am using wild card search which why it is failing. I changed the dynamic template by storing everything as keyword to resolve the issue. can you confirm if this approach will have any issues in future..for me wild card search is mandatory.

If running (very) slow searches is not an issue then may be that's correct.
But I always prefer running fast queries so I prefer using things like ngram based analyzers.

Thanks for the response . I will surely go through the nggram analyzers for partial search.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.