News in index but not searchable

I made a request
curl http://localhost:9200/news/data/news_nL8N1JW2U5.xml
and get the results

{"_index":"news","_type":"data","_id":"news_nL8N1JW2U5.xml","_version":1,"found":true,"_source":{"news_id": "nL8N1JW2U5.xml", "attributes": [{"context": "", "source": "Thomson Reuters", "titles": ["NATO allies look for reassurance from Trump in Warsaw"], "definition": "Trump visit is diplomatic coup for Poland's rightwing government Seen as second chance to patch up trans Atlantic ties West Europeans nervous over potential eurosceptic echoes By Marcin Goclowski and Roberta Rampton WARSAW, July 6 ( ) U.S. President Donald Trump meets eastern NATO allies in Warsaw on Thursday amid expectations he will reaffirm Washington's commitment to counter threats from Russia after unnerving them in May by failing to endorse the principle of collective defence. En route to a potentially fractious G20 summit in Germany, Trump will take part in a gathering of leaders from central Europe, Baltic states and the Balkans, an event convened by Poland and Croatia to boost regional trade and infrastructure. The White House has said Trump will use the stopover in Warsaw to showcase his commitment to the North Atlantic Treaty Organisation, which he once called "obsolete", a likely effort to patch up relations after the tense alliance summit in May. Poland's conservative and eurosceptic government, which shares views with Trump on issues such climate change, migration and coal mining, has hailed the U.S. president's visit as a recognition of its role as a leading voice in central Europe. The west Europeans, critical of Poland's democratic record, will be watchful as to whether Trump, who will give a major policy speech on a Warsaw square, may encourage its government in its defiance of Brussels. Some west European governments are worried over a deepening divide between east and west within the European Union and some diplomats see Thursday's regional summit as a Polish bid to carve out influence outside EU structures. Poland also wants to buy liquefied natural gas from U.S. companies to counterbalance Russian gas supplies in the region. "We are simply an important country in this part of the world," Polish President Andrzej Duda said in an interview with the PAP news agency. "We are among the biggest countries in Europe, we are a leader of central Europe, and President Trump ... understands this." Like other countries close to the NATO frontline with Russia, Poland will be eager to hear Trump embrace the alliance principle that an attack against one member represents an attack against all of them. Trump, who has praised Russian President Vladimir Putin in the past, flustered allies at his first NATO summit when he dropped a mention of the mutual defence principle, known as Article 5, which is the bedrock of the trans Atlantic partnership. "The White House sees opportunities to fix the problem that they created in Brussels where it looked like there was a big trans Atlantic divide," said Julie Smith, who was a national security adviser to former U.S. Vice President Joe Biden. "If he has a very warm welcome in Poland ... that could help push back on the narrative that he's not developing strong partnerships with our closest allies," Smith, now with the Center for a New American Security in Washington, told . (Writing by Justyna Pawlak; Editing by Richard Balmforth) ((Justyna.Pawlak@thomsonreuters.com; +48 22 6539706;)) Keywords: POLAND USA/TRUMP", "topics": [{"name": "Washington / US Government News", "lang": "en", "type": "Government Body"}, {"name": "Eastern Europe", "lang": "en", "type": "Geography"}, {"name": "Middle East", "lang": "en", "type": "Geography"}, {"name": "Reuters News Service", "lang": "en", "type": "Source"}, {"name": "Germany", "lang": "en", "type": "Geography"}, {"name": "Commodities umbrella", "lang": "en", "type": "Reuters Legacy Code"}, {"name": "Europe", "lang": "en", "type": "Geography"}, {"name": "Korean Democratic Republic (north)", "lang": "en", "type": "Geography"}, {"name": "United States of America", "lang": "en", "type": "Geography"}, {"name": "European Union", "lang": "en", "type": "Government Body"}, {"name": "Diplomacy; International Relations", "lang": "en", "type": "INTERNATIONAL RELATIONS"}, {"name": "Emerging countries", "lang": "en", "type": "Country Grouping"}, {"name": "Asia", "lang": "en", "type": "Geography"}, {"name": "Poland", "lang": "en", "type": "Geography"}, {"name": "Domestic Politics", "lang": "en", "type": "POLITICS"}, {"name": "Ukraine", "lang": "en", "type": "Geography"}, {"name": "English", "lang": "en", "type": "Language"}, {"name": "Russian Federation", "lang": "en", "type": "Geography"}, {"name": "Western Europe", "lang": "en", "type": "Geography"}], "published_ts": "20170706T010010+0000", "link": ""}], "type": "news", "context-type": "rabbitmq", "created_at": "2017-07-06"}}

Then i try to find these news by
curl -XGET 'http://localhost:9200/news/data/_search?pretty=true' -d '
{
"query" : {
"constant_score" : {
"filter" : {
"term" : {
"news_id" : "nL8N1JW2U5.xml"
}
}
}
}
}
'
and don't have result.
Please explain what comes wrong?

Analysis I guess.

Try with news_id.keyword if you are using defaults.

Sorry for long reply.
I tried by other field
curl -XGET 'http://localhost:9200/news/data/_search?pretty=true' -d '
{
"query" : {
"constant_score" : {
"filter" : {
"term" : {
"published_ts" : "20170720T120023+0000"
}
}
}
}
}
'

curl -XGET 'http://localhost:9200/news/data/_search?pretty=true' -d '
{
"query" : {
    "constant_score" : { 
        "filter" : {
            "term" : { 
                "published_ts" : "20170622T210436+0000"
            }
        }
    }
}
}
'

news with old date system found, but after one date not found.
Previously i remade index, maybe it broke smth, but i didn't find.

List of command which i made to remake index(i just move some type of data to other index)

2. elasticdump --input=http://localhost:9200/entity --output=/srv/dump/entity.json --type=data
3. elasticdump --input=http://localhost:9200/entity --output=/srv/dump/entity_mapping.json --type=mapping
4. curl -XPUT 'http://localhost:9200/entity/_mapping/data' -d @map_newfield.json
5. curl -XPOST 'http://localhost:9200/entity/data/_update_by_query?pretty=true' -d '{
    "query": {
        "term": {
            "type":"news"
        }
    },
    "script" : {
        "inline":"for (int i = 0; i < ctx._source.attributes.size(); i++){ ctx._source.titles = ctx._source.attributes[i].titles; ctx._source.source = ctx._source.attributes[i].source;ctx._source.topics = ctx._source.attributes[i].topics;ctx._source.definition = ctx._source.attributes[i].definition;ctx._source.published_ts = ctx._source.attributes[i].published_ts}"
        }
}'
6. curl -XPOST 'http://localhost:9200/entity/data/_update_by_query?pretty=true' -d '{
    "script" : {
        "inline":"ctx._source.remove(\"attributes\")"
    }
}'
7. curl -XPUT 'http://localhost:9200/news' -d @map_2.json
8. elasticdump --input=http://localhost:9200/entity --output=http://localhost:9200/news --type=data



9.curl -i -XPUT http://localhost:9200/_search/template/news -H 'Content-Type":" application/json' --data-binary "@news_v21.mustache"
10.curl -XDELETE http://localhost:9200/entity
11.elasticdump --output=http://localhost:9200/entity --input=/srv/dump/entity_mapping.json --type=mapping
12.elasticdump --output=http://localhost:9200/entity --input=/srv/dump/entity.json --type=data

delete news
POST /entity/data/_delete_by_query
{
    "query": {
        "bool": {
            "must": [
               {                   
                   "match": {
                      "type": "news"
                   }
               }
            ]
        }
    }
}

delete not news
POST /news/data/_delete_by_query
{
    "query": {
        "bool": {
            "must_not": [
               {                   
                   "match": {
                      "type": "news"
                   }
               }
            ]
        }
    }
}
curl -XPOST 'http://localhost:9200/_forcemerge?only_expunge_deletes=true'
curl -XPOST 'http://localhost:9200/news/_forcemerge?only_expunge_deletes=true'

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