Getting unrelated data while searching with -* in simple_query_string

Hi
I am using simple_query_string method with suffix * (operator) for getting result
But when i am searching with odd number of - getting unrelated data but with even number of - getting empty data.

Hi @ms.t

The use of images makes it difficult to reproduce the scenario, prefer to use code tools.

If possible, provide data such as mapping and documents so that it is possible to reproduce the problem.

Hi @RabBit_BR, index mapping and sample document for your reference

{"mappings":{"properties":{"application":{"type":"keyword"},"creationTime":{"type":"date"},"description":{"type":"text"},"entityCreatedOn":{"type":"date"},"entityModifiedOn":{"type":"date"},"entityUniqueId":{"type":"keyword"},"modificationTime":{"type":"date"},"protectedRecord":{"type":"boolean"},"queryText":{"type":"object"},"metaData":{"type":"text"},"searchAppearance":{"type":"object"},"visitCount":{"type":"long"},"roleRelated":{"type":"keyword"},"title":{"type":"text"},"type":{"type":"keyword"},"url":{"type":"keyword"},"userRelated":{"type":"keyword"},"workGroupRelated":{"type":"keyword"}}},"settings": {
"analysis": {
"analyzer": {
"default": {
"tokenizer": "whitespace",
"filter": [ "lowercase","my_custom_stop_words_filter" ]
}
},
"filter": {
"my_custom_stop_words_filter": {
"type": "stop",
"ignore_case": true,
"stopwords": [ "and", "is", "the", "a", "an", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "it", "no", "not", "of", "on", "or", "such", "that", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with","am" ]
}
}
}
}}

Document :

{
"entityUniqueId": "searchAppearanceTest2",
"application": "Administration",
"type": "User",
"title": "test data",
"description": "For search testing purpose",
"url": "",
"queryText": null,

"metaData": null,
"userRelated": ["manohar.singh"],
"workGroupRelated": null,
"protectedRecord": false,
"entityCreatedOn": 1645091657260,
"entityModifiedOn": 1645091657260
}

Hi @ms.t

You are using a operator. Look the doc:

the simple_query_string query supports the following operators:

  • + signifies AND operation
  • | signifies OR operation
  • - negates a single token
  • " wraps a number of tokens to signify a phrase for searching
  • * at the end of a term signifies a prefix query
  • ( and ) signify precedence
  • ~N after a word signifies edit distance (fuzziness)
  • ~N after a phrase signifies slop amount

Hi @RabBit_BR ,
Could you please explain why i am getting unrelated data when using odd number of - with suffix * with sample_query_string method?

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