[query_shard_exception]Failed to parse query

I was trying to run a search query on the twitter data, i inserted in to elasticsearch. This is the error i am getting in kibana but not on from terminal where i have used curl version of the same query.
From curl i am actually getting a proper output.

{
  "error": {
    "root_cause": [
      {
        "type": "query_shard_exception",
        "reason": "Failed to parse query [\"user.screen_name\":\"Samdundundun\"]",
        "index_uuid": "VRdEr5moQIOnWVRj0DEvPQ",
        "index": "political_tweets"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "political_tweets",
        "node": "l6mPecLzQzS8SRv0b38qnw",
        "reason": {
          "type": "query_shard_exception",
          "reason": "Failed to parse query [\"user.screen_name\":\"Samdundundun\"]",
          "index_uuid": "VRdEr5moQIOnWVRj0DEvPQ",
          "index": "political_tweets",
          "caused_by": {
            "type": "parse_exception",
            "reason": "Cannot parse '\"user.screen_name\":\"Samdundundun\"': Encountered \" \":\" \": \"\" at line 1, column 18.\nWas expecting one of:\n    <EOF> \n    <AND> ...\n    <OR> ...\n    <NOT> ...\n    \"+\" ...\n    \"-\" ...\n    <BAREOPER> ...\n    \"(\" ...\n    \"*\" ...\n    \"^\" ...\n    <QUOTED> ...\n    <TERM> ...\n    <FUZZY_SLOP> ...\n    <PREFIXTERM> ...\n    <WILDTERM> ...\n    <REGEXPTERM> ...\n    \"[\" ...\n    \"{\" ...\n    <NUMBER> ...\n    ",
            "caused_by": {
              "type": "parse_exception",
              "reason": "Encountered \" \":\" \": \"\" at line 1, column 18.\nWas expecting one of:\n    <EOF> \n    <AND> ...\n    <OR> ...\n    <NOT> ...\n    \"+\" ...\n    \"-\" ...\n    <BAREOPER> ...\n    \"(\" ...\n    \"*\" ...\n    \"^\" ...\n    <QUOTED> ...\n    <TERM> ...\n    <FUZZY_SLOP> ...\n    <PREFIXTERM> ...\n    <WILDTERM> ...\n    <REGEXPTERM> ...\n    \"[\" ...\n    \"{\" ...\n    <NUMBER> ...\n    "
            }
          }
        }
      }
    ]
  },
  "status": 400
}

The query i am running is

curl -XGET "http://localhost:9200/political_tweets/_search?q="user.screen_name":"Samdundundun""

Sample document is

{
  "_index" : "political_tweets",
  "_type" : "_doc",
  "_id" : "1",
  "_version" : 1,
  "_seq_no" : 0,
  "_primary_term" : 1,
  "found" : true,
  "_source" : {
    "created_at" : "Mon Dec 16 04:32:43 +0000 2019",
    "id" : 1206431941710368769,
    "id_str" : "1206431941710368769",
    "text" : "RT @kukk44: 4: Like the changes to the citizenship law, this promise of Hindutava has formed part of the bjp’s election manifesto since Mr…",
    "source" : """<a href="https://mobile.twitter.com" rel="nofollow">Twitter Web App</a>""",
    "truncated" : false,
    "in_reply_to_status_id" : null,
    "in_reply_to_status_id_str" : null,
    "in_reply_to_user_id" : null,
    "in_reply_to_user_id_str" : null,
    "in_reply_to_screen_name" : null,
    "user" : {
      "id" : 4786573094,
      "id_str" : "4786573094",
      "name" : "Sam",
      "screen_name" : "Samdundundun",
      "location" : null,
      "url" : null,
      "description" : null,
      "translator_type" : "none",
      "protected" : false,
      "verified" : false,
      "followers_count" : 6,
      "friends_count" : 8,
      "listed_count" : 0,
      "favourites_count" : 1366,
      "statuses_count" : 1107,
      "created_at" : "Wed Jan 20 02:21:57 +0000 2016",
      "utc_offset" : null,
      "time_zone" : null,
      "geo_enabled" : false,
      "lang" : null,
      "contributors_enabled" : false,
      "is_translator" : false,
      "profile_background_color" : "F5F8FA",
      "profile_background_image_url" : "",
      "profile_background_image_url_https" : "",
      "profile_background_tile" : false,
      "profile_link_color" : "1DA1F2",
      "profile_sidebar_border_color" : "C0DEED",
      "profile_sidebar_fill_color" : "DDEEF6",
      "profile_text_color" : "333333",
      "profile_use_background_image" : true,
      "profile_image_url" : "http://pbs.twimg.com/profile_images/1160692255687995392/c5TBNpcv_normal.jpg",
      "profile_image_url_https" : "https://pbs.twimg.com/profile_images/1160692255687995392/c5TBNpcv_normal.jpg",
      "default_profile" : true,
      "default_profile_image" : false,
      "following" : null,
      "follow_request_sent" : null,
      "notifications" : null
    },
    "geo" : null,
    "coordinates" : null,
    "place" : null,
    "contributors" : null,
    "retweeted_status" : {
      "created_at" : "Mon Dec 16 02:30:08 +0000 2019",
      "id" : 1206401089056034816,
      "id_str" : "1206401089056034816",
      "text" : "4: Like the changes to the citizenship law, this promise of Hindutava has formed part of the bjp’s election manifes… https://t.co/oaUCpxAiPp",
      "source" : """<a href="http://twitter.com/download/iphone" rel="nofollow">Twitter for iPhone</a>""",
      "truncated" : true,
      "in_reply_to_status_id" : 1206401087319621632,
      "in_reply_to_status_id_str" : "1206401087319621632",
      "in_reply_to_user_id" : 16804541,
      "in_reply_to_user_id_str" : "16804541",
      "in_reply_to_screen_name" : "kukk44",
      "user" : {
        "id" : 16804541,
        "id_str" : "16804541",
        "name" : "kukki44 ( ‎انجنا ملھوترا )",
        "screen_name" : "kukk44",
        "location" : "Hong Kong",
        "url" : null,
        "description" : "Life is a Choice between Ageing and Growing...!! Ageing is Adding Years to Life..While Growing is Adding Life to Years..!!!",
        "translator_type" : "none",
        "protected" : false,
        "verified" : false,
        "followers_count" : 9732,
        "friends_count" : 2485,
        "listed_count" : 23,
        "favourites_count" : 193401,
        "statuses_count" : 204110,
        "created_at" : "Thu Oct 16 08:48:30 +0000 2008",
        "utc_offset" : null,
        "time_zone" : null,
        "geo_enabled" : false,
        "lang" : null,
        "contributors_enabled" : false,
        "is_translator" : false,
        "profile_background_color" : "0099B9",
        "profile_background_image_url" : "http://abs.twimg.com/images/themes/theme4/bg.gif",
        "profile_background_image_url_https" : "https://abs.twimg.com/images/themes/theme4/bg.gif",
        "profile_background_tile" : false,
        "profile_link_color" : "0099B9",
        "profile_sidebar_border_color" : "5ED4DC",
        "profile_sidebar_fill_color" : "95E8EC",
        "profile_text_color" : "3C3940",
        "profile_use_background_image" : true,
        "profile_image_url" : "http://pbs.twimg.com/profile_images/1202769401683988482/Zck6ZzF6_normal.jpg",
        "profile_image_url_https" : "https://pbs.twimg.com/profile_images/1202769401683988482/Zck6ZzF6_normal.jpg",
        "default_profile" : false,
        "default_profile_image" : false,
        "following" : null,
        "follow_request_sent" : null,
        "notifications" : null
      },
      "geo" : null,
      "coordinates" : null,
      "place" : null,
      "contributors" : null,
      "is_quote_status" : false,
      "extended_tweet" : {
        "full_text" : """4: Like the changes to the citizenship law, this promise of Hindutava has formed part of the bjp’s election manifesto since Mr Shah’s boss, Narendra Modi, became India’s prime minister in 2014.
https://t.co/2kSdeivmaH""",
        "display_text_range" : [
          0,
          217
        ],
        "entities" : {
          "hashtags" : [ ],
          "urls" : [
            {
              "url" : "https://t.co/2kSdeivmaH",
              "expanded_url" : "https://www.economist.com/asia/2019/12/12/indias-new-citizenship-law-outrages-muslims",
              "display_url" : "economist.com/asia/2019/12/1…",
              "indices" : [
                194,
                217
              ]
            }
          ],
          "user_mentions" : [ ],
          "symbols" : [ ]
        }
      },
      "quote_count" : 0,
      "reply_count" : 2,
      "retweet_count" : 12,
      "favorite_count" : 11,
      "entities" : {
        "hashtags" : [ ],
        "urls" : [
          {
            "url" : "https://t.co/oaUCpxAiPp",
            "expanded_url" : "https://twitter.com/i/web/status/1206401089056034816",
            "display_url" : "twitter.com/i/web/status/1…",
            "indices" : [
              117,
              140
            ]
          }
        ],
        "user_mentions" : [ ],
        "symbols" : [ ]
      },
      "favorited" : false,
      "retweeted" : false,
      "possibly_sensitive" : false,
      "filter_level" : "low",
      "lang" : "en"
    },
    "is_quote_status" : false,
    "quote_count" : 0,
    "reply_count" : 0,
    "retweet_count" : 0,
    "favorite_count" : 0,
    "entities" : {
      "hashtags" : [ ],
      "urls" : [ ],
      "user_mentions" : [
        {
          "screen_name" : "kukk44",
          "name" : "kukki44 ( ‎انجنا ملھوترا )",
          "id" : 16804541,
          "id_str" : "16804541",
          "indices" : [
            3,
            10
          ]
        }
      ],
      "symbols" : [ ]
    },
    "favorited" : false,
    "retweeted" : false,
    "filter_level" : "low",
    "lang" : "en",
    "timestamp_ms" : "1576470763982"
  }
}

please take your time to properly describe your problem instead of simply pasting an exception in here. See https://www.elastic.co/help

index creation, document indexing, mapping configuration, the query itself, elasticsearch version would all be super useful in order to be able to start debugging this issue.

sorry @spinscale i am new here didn't thought of describing the problem in hurry.now i updated the issue. can you please help me with it.

try using the search endpoint where you have to provide a search body. This way you do not need to escape any double ticks in your shell

curl -XGET "http://localhost:9200/political_tweets/_search"
-d '{ "query": { "query_string" : "user.screen_name:Samdundundun" } }'

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